Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = open('26_21719.txt').readlines()
- n = int(data[0])
- d = {}
- for e in data[1:]:
- student, task = map(int, e.split())
- if student not in d:
- d[student] = []
- d[student].append(task)
- mx = 0
- best_student = -1
- for student in d:
- d[student] = sorted(list(set(d[student])))
- answ = 0
- cur = 1
- for i in range(1, len(d[student])):
- if d[student][i] - d[student][i - 1] == 2:
- cur += 1
- answ = max(answ, cur)
- else:
- cur = 1
- if answ > mx:
- mx = answ
- best_student = student
- print(best_student, mx)
Advertisement
Add Comment
Please, Sign In to add comment