Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open('8.txt')
- L, N = map(int, file.readline().split())
- a = [0] * (L + 1)
- for i in range(N):
- st, end = map(int, file.readline().split())
- a[st] += 1
- a[end] -= 1
- k = 0
- prost = 0
- sum_prost = 0
- m = 0
- for i in range(L):
- k += a[i]
- if k == 0:
- prost += 1
- else:
- m = max(m, prost)
- sum_prost += prost
- prost = 0
- print(sum_prost, m)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement