| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 49 | 44 | 37 | 92.500% |
Charlotte Michelle Simone is organizing the Especially Interesting Olympiad. Now she has the solutions of all the participants and needs to compile the ranking.
There are several tasks in the olympiad. Each participant can submit any number of solutions for each task, and each solution scores some number of points. The score of a participant for a task is the maximum of the scores of their solutions for that task (or zero, if they did not submit any solutions for that task). The total score of a participant is the sum of their scores over all tasks.
Write a program to compile the ranking of the participants according to their total scores.
The first line contains an integer $N,ドル the number of solutions submitted (1ドル \le N \le 200,000円$).
Each of the following $N$ lines describes one solution, giving the account name of the participant, the name of the task, and the number of points the solution scored, separated from each other by spaces. Each account name and each task name consists of 1 to 20 lower-case letters of the Latin alphabet. Each solution may score 0 to 100 points (always an integer).
You may assume that there are no more than 10ドル,000円$ participants and no more than 10ドル$ tasks.
Output one line per participant, listing their account name and total score, separated by a space. The lines should be ordered in the non-increasing order of the scores. The lines with equal scores may be listed in any order.
6 juku tul 3 mari har 5 mari har 4 juku har 4 mari tul 1 mari tul 5
mari 10 juku 7
John (using the account name juku) scored 3 points for the task tul and 4 points for har, for a total of 7 points. Solutions of Mary (using the account name mari) scored 5 and 4 points for har; the larger of the two, which is 5 points, is her score for this task. Likewise, she gets 5 points for tul, for a total of 10 points. As she got more points, she is listed first in the ranking.