Skip to Content

Leaderboard

Level B. Teaches records, reading a list of records and sort(by:).

There are n players (1 ≤ n ≤ 1000). Each has a name (lowercase letters, at most 10) and a score from 0 to 100. Print the leaderboard: highest score first, and players with the same score in alphabetical order of name. Each line is the place (1, 2, 3, …; tied players still get consecutive places), a dot, the name and the score.

Input: n, then n lines name score. Output: n lines.

InputOutput
4
ana 30
bo 50
cy 30
dee 10
1. bo 50
2. ana 30
3. cy 30
4. dee 10
5 tests · Ctrl+Enter