아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Ranking

시간 제한1초메모리 제한1024 MB

요약
각 참가자의 과제별 최고 점수를 합산해 총점을 구하고, 총점 내림차순으로 참가자와 점수를 출력한다.
난이도

보통10점 중 4점

유형
해시맵, 정렬
정답자
아직 제출이 없습니다

문제

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 NN, the number of solutions submitted (1≤N≤200,0001 \le N \le 200\\,000).

Each of the following NN 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,00010\\,000 participants and no more than 1010 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.

예제1

  1. 예제 1

    입력
    6
    juku tul 3
    mari har 5
    mari har 4
    juku har 4
    mari tul 1
    mari tul 5
    
    예상 출력
    mari 10
    juku 7