Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = open("27.txt").readlines()
- k = int(data[0])
- n = int(data[1])
- a = []
- for i in range(n):
- l, r = map(int, data[2 + i].split())
- a.append((l - 1, 0, i))
- a.append((r + 1, -1, i))
- a.sort()
- c = [-1] * k
- answ = 0
- lst = -1
- for e in a:
- time, typ, ind = e
- if typ == 0:
- if -1 in c:
- lst = c.index(-1)
- c[c.index(-1)] = ind
- answ += 1
- else:
- if ind in c:
- c[c.index(ind)] = -1
- print(answ, lst + 1)
Advertisement
Add Comment
Please, Sign In to add comment