071228xx @ 2023-04-05 16:52:14
lis = list(input().split())
len = int(lis[0])
a = int(lis[1])
i = 0
l = [0] * len
u = v = 0
count = len + 1
import sys
while(i < a):
u , v = map(int , input().split())
if(u > v):
sys.exit()
while(u <= v):
if(l[u] == 0):
l[u] = 1
count -= 1
u += 1
i += 1
print(count)
by wanglexi @ 2023-10-31 19:32:17
你怎么能l = [0] * len
呢?
因为树种在l = [0] * len
应该为l = [0] * (len+1)
by wanglexi @ 2023-10-31 19:32:38
@071228xx