Score Management
Time limit1sMemory limit1024 MB
Rank participants by score with shared ranks for ties, then print the rank, name, and score of each non-hidden participant sorted by rank and then name.
- Level
Easy3 of 10
- Topics
- Sorting, Implementation
- Solved
- No attempts yet
Problem
Minkyeom manages the scores of the participants of 2023 INPC. He wants to publish a ranking table, and you will write the program that builds it. Each participant has three values: a name, a score, and a hidden flag.
- There are participants in 2023 INPC.
- Each participant has a name, a score, and a hidden flag.
- The name is a string of lowercase English letters with a length between 1 and 10.
- The score is an integer between 1 and .
- The hidden flag is true or false. It decides whether the participant is hidden from the ranking table.
- If two scores differ, the higher score gets the higher rank. The best rank is 1, and the worst rank is .
- If participants share a score, all of them get the highest rank possible. For example, if six participants have scores 10, 10, 8, 6, 6, 6, their ranks are 1, 1, 3, 4, 4, 4.
- The ranking table shows only the participants who are not hidden, from the highest rank down. Each participant is shown with rank, name, and score. Among participants with the same rank, the name that comes first in dictionary order is shown first. Hidden participants must not appear in the table. The hidden flag does not change the actual ranks.
Input
The first line contains the number of participants . Each of the next lines contains the information of one participant, written without spaces in the form {"name":"name","score":score,"isHidden":hidden flag}. The hidden flag is 1 if the participant is hidden and 0 otherwise.
There is one opening bracket before the first participant's information and one closing bracket after the last participant's information. Each line except the last one ends with one comma.
Output
Print the correct ranking table. Each line contains the rank, name, and score of one participant, separated by spaces. Print participants from the highest rank down. If participants share a rank, print the one whose name comes first in dictionary order first. Do not print participants whose hidden flag is true.
Constraints
- All participant names are different.
- At least one participant is not hidden.