用python写:行数很少,但是运行超时,求指点

list1=[] #储存树对应的数字
a,b=(int(n) for n in input().split())
for i in range(0,b):
c , d = (int(n) for n in input().split())
for j in range(c,d+1):
if j not in list1: #范围内树对应的数字 如果不在列表内 就添加在列表内
list1.append(j)
length = len(list1) #要移除的树的数量
print(a+1-length,end='')

0 条评论

目前还没有评论...

信息

ID
1103
难度
4
分类
模拟 点击显示
标签
递交数
14290
已通过
6515
通过率
46%
被复制
50
上传者