当前位置:网站首页>Nlp-d57-nlp competition D26 & skimming questions D13 & reading papers & finding bugs for more than an hour
Nlp-d57-nlp competition D26 & skimming questions D13 & reading papers & finding bugs for more than an hour
2022-06-22 19:52:00 【Zhen xiaopang】
—— I finished three papers in the morning , Subconsciously open wechat to read , A few good books were added . Now I always feel that reading time is precious 、 Warm , I hope to leave a space for my heart , Maybe it's a green shade . Now it's time to brush the questions !
2816 Double pointer

803 Interval merging
n = int(input())
a = []
res = []
for _ in range(n):
a.append(list(map(int,input().split())))
res.append(a[0])
# The interval merging algorithm needs to sort according to the value of the first point ,
# Otherwise, the operation is as fierce as a tiger
a.sort()
for i in range(1,n):
if res[-1][1]>=a[i][0]:
res[-1][1] = max(res[-1][1],a[i][1])
else:
res.append(a[i])
print(len(res))
Double linked list
look for bug It makes me feel sick 
I vomited. , For half an hour , No picture
m = int(input())
h,t = 0,1
r,l,e= [0]*100010,[0]*100010,[0]*100010
l[1]=0
r[0]=1
idx = 2
def add_to_k(x,k):
global idx
# Insert... From the right
e[idx] =x
l[idx] = k+1
r[idx] = r[k+1]
l[r[k+1]] = idx
r[k+1] = idx
idx+=1
def remove(k):
r[l[k+1]] = r[k+1]
l[r[k+1]]=l[k+1]
for _ in range(m):
op,*pt = input().split()
# *pt When taking value pt[0]
if op=='L':
add_to_k(int(pt[0]),0)
elif op=='R':
add_to_k(int(pt[0]),l[1])
elif op=='D':
remove(int(pt[0]))
elif op=='IL':
k,x = map(int,pt)
add_to_k(x,l[k])
else:
k,x = map(int, pt)
add_to_k(x,k)
# First point to the first
h =r[h]
while h!=1:
# print(h)
# print(2)
print(e[h], end=' ')
h = r[h]
A little bit , Still wrong
m = int(input())
h,t = 0,1
r,l,e= [0]*100010,[0]*100010,[0]*100010
l[1]=0
r[0]=1
idx = 2
def add_to_k(x,k):
global idx
# Insert... From the right
e[idx] =x
l[idx] = k+1
r[idx] = r[k+1]
l[r[k+1]] = idx
r[k+1] = idx
idx+=1
def remove(k):
r[l[k+1]] = r[k+1]
l[r[k+1]]=l[k+1]
for _ in range(m):
op,*pt = input().split()
# *pt When taking value pt[0]
if op=='L':
add_to_k(int(pt[0]),-1)
elif op=='R':
add_to_k(int(pt[0]),l[1])
elif op=='D':
remove(int(pt[0]))
elif op=='IL':
k,x = map(int,pt)
add_to_k(x,l[k])
else:
k,x = map(int, pt)
add_to_k(x,k)
# First point to the first
h =r[h]
print(r)
# print(l)
while h!=1:
# print(h)
# print(2)
print(e[h], end=' ')
h = r[h]
To give up , Write directly with the original idea , It's almost an hour .
hold k+1 Change it to k Just fine .
I feel like I still use k As a number , When you call a function later, you should consider the k Which number is better . Because the operation of the head node and the tail node is based on the number , If the function is defined as the number of insertions , It is difficult to convert the head and tail nodes . therefore ,k That is, the function parameter is still defined as idx Good numbering .
remember : Double linked list function k yes idx Number , The first k An insert , Its idx The number is k+1!!! remember !!
Start recording some common df Operation
df[‘’].value_counts()
Count the types and corresponding numbers of a column of values
边栏推荐
猜你喜欢

A homekit enabled camera? Zhiting IPC camera IC1 unpacking experience

1.2----- mechanical design tools (CAD software) and hardware design tools (EDA software) and comparison

编译报错:/usr/bin/ld: /usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_32S against `.rodata‘

ABAQUS 使用RSG绘制插件初体验

图的存储结构(邻接矩阵)

YARN笔记

常用技术注解

Install some office tools

3D打印机耗材受潮

如何用银灿IS903主控DIY自己的U盘?(练习BGA焊接的好项目)
随机推荐
Calendar control programming
MySQL数据库DQL查询操作
0.0 - how can SolidWorks be uninstalled cleanly?
1.3----- simple setting of 3D slicing software
深入浅出聊布隆过滤器(Bloom Filter)
修改隐含参数造成SQL性能下降案例之一
08_ One word sobers you up
详解openGauss多线程架构启动过程
c# winform 嵌入flash
小波变换db4进行四层分解及其信号重构—matlab分析及C语言实现
取zip包中的文件名
1.3-----Simplify 3D切片软件简单设置
51万奖池邀你参战!第二届阿里云ECS CloudBuild开发者大赛来袭
Common technical notes
MySQL的函数
堆排序(原理加代码)
Weizhi technology appeared in the Western Digital Expo, and the space-time AI technology was highly recognized
C语言实现平衡二叉树
Screw database document generator
canvas给图片画框框