Advertisement
Farz0l1x

Untitled

May 1st, 2024
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. file = open('5.txt')
  2. K, N = map(int, file.readline().split())
  3. a = []
  4. for i in range(N):
  5.     st, end = map(int, file.readline().split())
  6.     a.append((st, end))
  7. a.sort()
  8. house = [0] * 1000
  9. last = 0
  10. for i in range(N):
  11.     st, end = a[i]
  12.     for j in range(1000):
  13.         if house[j] < st:
  14.             house[j] = end
  15.             last = len([x for x in house if x > st])
  16.             break
  17. house = [x for x in house if x != 0]
  18. print(len(house) / K, last)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement