Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import defaultdict
- groups = defaultdict(int) # подсчет отличников в группах
- n = int(input()) # количество учащихся
- max_amount = 0 # макс. количество отличников
- max_groups = set() # список групп с макс. количеством отличников
- for _ in range(n):
- *student_name, group, mark = input().split()
- group = int(group)
- mark = int(mark)
- if mark >= 8:
- groups[group] += 1
- if groups[group] > max_amount:
- max_amount = groups[group]
- max_groups = {group,}
- if groups[group] == max_amount:
- max_groups.add(group)
- print(*sorted(max_groups))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement