#C3185. Player Score Tracker

    ID: 46584 Type: Default 1000ms 256MiB

Player Score Tracker

Player Score Tracker

Tom is developing a new text-based game where players can gain or lose points based on their actions. The game accepts two types of queries: (UPDATE) and (TOP).

For a query of the form (UPDATE; player_name ; delta), the player's score is updated by adding the value (delta), which may be positive or negative. For a (TOP) query, the program must output the name(s) of the player(s) with the highest score, sorted in lexicographical order. In the event of a tie, output all top players separated by a single space. If no player has been updated before a (TOP) query, output an empty line.

inputFormat

The input is read from standard input. The first line contains an integer (Q), the number of queries. Each of the following (Q) lines contains a query, either in the format:

UPDATE player_name delta – to update a player's score by adding (delta).
TOP – to print the player(s) with the highest score.

outputFormat

For each (TOP) query, print a line to standard output containing the name(s) of the top player(s) in lexicographical order separated by a single space. If no score updates have been recorded before a (TOP) query, print an empty line.## sample

2
UPDATE alice 5
TOP
alice

</p>