#P104. [Sleeping Cup #4] Football Loser

[Sleeping Cup #4] Football Loser

Person in Charge

Attention

This problem requires file I/O (football.in / football.out).

Problem Background

To celebrate the 1st anniversary of Sleeping Cup, Sleeping Dolphin and its friends participated in a football match called Sleeping Cup World Cup Qualifiers on the morning of April 12, 2025. Team C suffered a crushing 0-7 defeat against Team J.

However, the head coach believed the team's strategy was not the issue—it was simply that the players were too inexperienced.

The members of Team C were at a loss, so they turned to you for help in analyzing the problem.

Problem Description

There are aa teams, each with a name bb. Each team has two positive integers mm and nn, representing the player ability score and the coach ability score, respectively.

Additionally, the team's assembly time tt must also be considered.

The total evaluation score kk is calculated as follows:

k=(0.6m+0.3n)×0.1tk = (0.6m + 0.3n) \times 0.1t

Your task is to compare the total evaluation scores of each team and output their names in descending order of kk.

Input Format

There are multiple test cases.

The first line contains an integer T (1T10)T\ (1 \le T \le 10), the number of test cases.

For each test case:

  • The first line contains an integer a (1a20)a\ (1 \le a \le 20), the number of teams.
  • The next aa lines each start with a string b (1b20)b\ (1 \le |b| \le 20), the team name, followed by three positive integers m,n,t (1m,n109,1t1000)m, n, t\ (1 \le m, n \le 10^9, 1 \le t \le 1000), representing the player ability score, coach ability score, and assembly time, respectively.

It is guaranteed that:

  • No ties will occur.
  • No two teams will share the same name.
  • Team names consist only of uppercase and lowercase letters.

Output Format

For each test case, output one line listing the team names in descending order of their total evaluation scores.

Samples

1
2
Sleeping 7 3 5
Cup 7 3 6
Cup Sleeping
2
1
Sleeping 77 5 6
3
C 7 3 4
h 7 3 5
n 7 3 6
Sleeping
n h C

Official Solution

link