You are developing a leaderboard system for a game. You are given a list of N players, where each player is represented by their name and their score.
Your task is to sort this list of players and print the resulting leaderboard according to two rules:
- Players should be sorted in descending order of their scores (highest score first).
- If two or more players have the same score, they should be sorted by their names in ascending lexicographical (alphabetical) order.
The first line of input contains an integer N, the number of players.
The next N lines each contain a player's name (a string) and their score (an integer), separated by a space.
The output should consist of N lines, each containing a player's name and score from the sorted list, separated by a space.
Player names will consist of only lowercase English letters and will not contain spaces.
4
david 100
alice 150
eve 150
bob 100
alice 150
eve 150
bob 100
david 100
The highest score is 150, shared by alice and eve.
We sort these two by name alphabetically: alice comes before eve.
The next highest score is 100, shared by david and bob.
We sort these two by name alphabetically: bob comes before david.
Combining these gives the final sorted order.
The expected time complexity is O(N * log N), which is standard for comparison-based sorting.
1 <= N <= 10^5
Player names are strings of length 1 to 20, containing only lowercase letters.
0 <= score <= 1000
Time limit: 1 sec