Under construction

Still being built. Things may change

Score Management

Time limit1sMemory limit1024 MB

Summary
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 NN 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 10910^9.
    • 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 NN.
  • 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 NN. Each of the next NN 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

  • 1≤N≤10001 \le N \le 1000
  • All participant names are different.
  • At least one participant is not hidden.

Examples2

  1. Example 1

    Input
    5
    [{"name":"yooshnn","score":9815,"isHidden":1},
    {"name":"netcopjr","score":9811,"isHidden":0},
    {"name":"chlwnsgud","score":9811,"isHidden":0},
    {"name":"aym","score":9815,"isHidden":0},
    {"name":"sonhy","score":9807,"isHidden":0}]
    
    Expected output
    1 aym 9815
    3 chlwnsgud 9811
    3 netcopjr 9811
    5 sonhy 9807
    
  2. Example 2

    Input
    1
    [{"name":"inpc","score":1000000000,"isHidden":0}]
    
    Expected output
    1 inpc 1000000000