Advertisement
Farz0l1x

Untitled

May 1st, 2024
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. file = open('7.txt')
  2. N = int(file.readline())
  3. a = [0] * 1_000_000
  4. for i in range(N):
  5.     st, end = map(int, file.readline().split())
  6.     a[st] += 1
  7.     a[end] -= 1
  8. k = 0
  9. m = 0
  10. count = 0
  11. for i in range(len(a)):
  12.     k += a[i]
  13.     m = max(m, k)
  14.     if k > 0:
  15.         count += 1
  16. print(m, count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement