#P13797. [SWERC 2023] Programming-trampoline-athlon!

[SWERC 2023] Programming-trampoline-athlon!

题目描述

:::align{center}

:::

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 66 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 C,P,E1,E2,E3,E4,E5,E6C, P, E_1, E_2, E_3, E_4, E_5, E_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 EiE_i is an integer specifying the execution score of trampoline element number ii.

Limits

  • 3N100 0003 \leq N \leq 100~000;
  • 3M1 0003 \leq M \leq 1~000;
  • CC consists of five uppercase English letters;
  • 0P60 \leq P \leq 6;
  • 0Ei100 \leq E_i \leq 10 for all 1i61 \leq i \leq 6;
  • different teams always have different team codes.

输出格式

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.

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
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