Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open('1.txt')
- K = int(file.readline())
- N = int(file.readline())
- a = []
- for i in range(N):
- st, end = map(int, file.readline().split())
- a.append((st, end))
- a.sort()
- camera = [0] * K
- count = 0
- last_camera = 0
- for i in range(N):
- st, end = a[i]
- for j in range(K):
- if camera[j] < st:
- camera[j] = end
- count += 1
- last_camera = j + 1
- break
- print(count, last_camera)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement