Programming-trampoline-athlon!

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

요약
각 팀의 점수는 해결한 문제 수 곱하기 10에, 트램폴린 6개 점수에서 최고점과 최저점을 제거한 나머지 4개의 합을 더한 값이다. 점수가 높은 순으로, 동점이면 입력 순서대로 팀 코드와 점수를 출력한다.
난이도

쉬움10점 중 3점

유형
정렬, 구현
정답자
아직 제출이 없습니다

문제

Programming competitions are fun and exciting. Programming should be an Olympic sport! At least, this is what we believe. However, when we suggested this to some of our friends, they did not seem to share our excitement. So, we decided to suggest a combined sport that will be more interesting to watch. Programming-trampoline-athlon! (we are still working on the name.)

The idea is as follows. This is a team sport, where each team comprises of 33 members. The team has at its disposal 11 hour, 11 computer, and 11 trampoline. At all times, there must be at most one team member using the computer and at least one team member jumping the trampoline. At the beginning of the competition, the team is given 6 programming problems, and 66 trampoline elements (exercises). The team decides how to partition the trampoline elements between its members, such that each team member has to perform 22 of the given elements on the trampoline. The programming tasks are solved cooperatively by the team members, but no one member can spend more than 2525 minutes on the computer in total. The scoring is comprised of two parts, which are added together:

  • The programming score ranges between 00 and 6060. The team receives 1010 points for every correctly solved problem.
  • The trampoline score ranges between 00 and 4040. Each of the 66 trampoline elements receives a score from the judges that ranges between 00 and 1010. The final trampoline execution score is determined by dropping the highest and lowest of the 66 scores, and then adding up the remaining 44 scores.

Before we pitch this new sport to the International Olympic Committee, we want everything to be ready in order to show them just how serious we are. Thus, each team should receive a medal when no more than two other teams obtained a strictly higher score. However, in order to cope with a recent shortage of medals, the jury was instructed to make sure that there would be no more than 1,0001\\, 000 teams deserving a medal. We ask you to write a program that determines the medallists, given the performance of the different teams.

입력

The first line contains the number NN of competing teams. Then follow NN lines. Each of these lines describes a team and contains space-separated values CC, PP, E_1E\_1, E_2E\_2, E_3E\_3, E_4E\_4, E_5E\_5, E_6E\_6; CC is a five-letter code used to identify the team, PP is an integer specifying the number of problems the team solved, and E_iE\_i is an integer specifying the execution score of trampoline element number i.

출력

The output should contain MM lines, where MM is the number of medallists. Each line should represent a medallist team, by containing two space-separated values CC and SS, where CC is the team code and SS is the total score of the team. Medallist teams should be listed by decreasing total score and, in case of ties, by input order.

제한

  • 3≤N≤100,0003 \le N \le 100\\, 000
  • 3≤M≤1,0003 \le M \le 1\\, 000
  • CC consists of five uppercase English letters;
  • 0≤P≤60 \le P \le 6
  • 0≤E_i≤100 \le E\_i \le 10 for all 1≤i≤61 \le i \le 6
  • different teams always have different team codes.

예제2

  1. 예제 1

    입력
    5
    EMAIL 3 5 6 7 8 9 10
    CRASH 2 7 1 8 2 8 1
    MOUSE 4 0 9 3 9 1 7
    SWERC 6 3 1 4 1 5 9
    PAINT 6 0 0 0 0 0 10
    
    예상 출력
    SWERC 73
    EMAIL 60
    MOUSE 60
    PAINT 60
    
  2. 예제 2

    입력
    4
    CRAZY 4 0 2 4 6 8 10
    JAZZY 2 9 9 9 9 9 9
    JUICY 3 2 9 10 9 10 1
    FUZZY 5 0 1 1 2 3 5
    
    예상 출력
    CRAZY 60
    JUICY 60
    FUZZY 57