Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- contests = {}
- data = input()
- individual_standings = {}
- # data_users = []
- while not data == 'no more time':
- username, contest, points = data.split(" -> ")
- points = int(points)
- if contest not in contests:
- contests[contest] = {username: points}
- # contests[contest][username] = points
- else:
- if username in contests[contest]:
- contests[contest][username] = points
- if contests[contest][username] <= points:
- contests[contest][username] = points
- else:
- contests[contest][username] = points
- if username not in individual_standings:
- individual_standings[username] = points
- else:
- if individual_standings[username] <= points:
- individual_standings[username] = points
- else:
- individual_standings[username] += points
- data = input()
- for key, value in contests.items():
- print(f"{key}: {len(value)} participants")
- i = 1
- sorted_items = dict(sorted(value.items(), key=lambda x: (-x[1], x[0])))
- for k2, v2 in sorted_items.items():
- print(f'{i}. {k2} <::> {v2}')
- i += 1
- print('Individual standings:')
- i = 1
- for key, value in sorted(individual_standings.items(), key=lambda x: (-(x[1]), x[0])):
- print(f'{i}. {key} -> {value}')
- i += 1
- # TODO 66 / 100 Judge
Advertisement
Add Comment
Please, Sign In to add comment