题解 | 校门外的树
校门外的树
https://www.nowcoder.com/practice/0e8cfc82936048769af45967f3c4ef7e
l,m = map(int,input().split())
diff = [0]*(l+2)
for _ in range(m):
a,b = map(int,input().split())
diff[a] += 1
if b+1<=l:
diff[b+1] -= 1
count = 0
current = 0
for i in range(l+1):
current += diff[i]
if current==0:
count+=1
print(count)
查看1道真题和解析