当前位置:网站首页>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
边栏推荐
- 使用 Order by 与 rownum SQL 优化案例一则
- Altium Designer中off grid pin解决方法
- 08_一句话让你人间清醒
- Geometrical product specifications (GPS) - ISO code system for linear dimensional tolerances
- 元宇宙怎么就这么火,市场喊起来的10万亿是吹嘘还是真相?
- Decorator mode of structural mode
- MySQL数据库DQL练习题
- Weizhi technology appeared in the Western Digital Expo, and the space-time AI technology was highly recognized
- MySQL多表操作练习题
- 拓扑排序
猜你喜欢

实验七 触发器

Openpnp debugging ------ 0816 Feida Tui 0402 taping

84. (cesium chapter) movement of cesium model on terrain
![[nfs failed to mount problem] mount nfs: access denied by server while mounting localhost:/data/dev/mysql](/img/15/cbb95ec823cdde5fb8f032dc45cfc7.png)
[nfs failed to mount problem] mount nfs: access denied by server while mounting localhost:/data/dev/mysql

ActiveReports报表实战应用教程(十九)——多数据源绑定

A homekit enabled camera? Zhiting IPC camera IC1 unpacking experience
![[dry goods | necessary skills for interface testing common interface protocol analysis]](/img/6f/752078d6aac782c48c13c5d04ac525.png)
[dry goods | necessary skills for interface testing common interface protocol analysis]

Damp 3D printer consumables

0.1-----用AD画PCB的流程

界面开发组件DevExpress ASP.NET Core v21.2 - UI组件增强
随机推荐
第一章 力扣热题100道(1-5)
Quick indent usage in VIM
Teachers, I want to ask you a question. I run flinkcdc locally to synchronize MySQL data. The timestamp field parsing is normal,
The custom control autoscalemode causes the problem of increasing the width of font
YARN笔记
如何在 FlowUs和Notion 等笔记软件中进行任务管理?
希尔排序
从11小时到25秒--还有优化空间吗?
Openpnp使用过程的一些问题记录
【干货|接口测试必备技能-常见接口协议解析】
C WinForm embedded flash
MySQL数据库DQL查询操作
Xintang nuc980 usage record: basic description of development environment preparation and compilation configuration
Ts as const
Velocity syntax
1.4----- PCB design? (circuit design) determination scheme
3D打印机耗材受潮
B树代码(C语言)
常用技术注解
Mini web framework: template replacement and routing list function development | dark horse programmer