#C963. Leaderboard Generation
Leaderboard Generation
Leaderboard Generation
You are given the scores of players from multiple gaming sessions. Your task is to generate a leaderboard by aggregating the scores of each player across all sessions.
The players should be ranked in descending order of their total scores. In the event of a tie, order the players in lexicographical order (i.e., alphabetical order). The ranking follows the competition ranking system: players with the same total score share the same rank, and the next rank is incremented by the number of players in the previous rank group.
All input is read from standard input (stdin) and all output should be written to standard output (stdout).
inputFormat
The first line contains an integer T, the number of sessions.
- For each session, the first line contains an integer N, the number of players in that session.
- This is followed by N lines, each containing a player's name (a non-space string) and an integer score separated by a space.
outputFormat
For each rank group in the leaderboard, output one line. Each line should start with the rank followed by the names of the players sharing that rank, separated by a space. The groups must be printed in order of increasing rank.
## sample3
3
Alice 50
Bob 40
Charlie 30
3
Alice 30
Bob 50
Charlie 50
3
Alice 40
Bob 30
Charlie 40
1 Alice Bob Charlie
</p>