AUCPL Intro
Welcome to the first competition of the Adelaide University Competitive Programming League!
The rounds of competitions held throughout the year will determine the winner of the league, with first place having their name engraved on a trophy.
Leaderboard position is determined by a team's best results, ordered by the total number of problems they have solved. If it's a tie, the winner is the team with the smallest total time to solve questions from their best
contests.
Given a list of each team's results, can you find the team name which should be engraved on the trophy?
Note: It is guaranteed that there will be exactly one team which will win the league. If it comes down to tiebreak by smallest total time, exactly one team will have to smallest total time for their best 6 contests.
Input
The first line consists of an integer
, the number of teams.
For each team, there will be the following format in the input:
A string
, the team name,
On the next line, an integer
, the number of AUCPL Rounds they have participated in,
Followed by lines representing the team's result in a given competition, each consisting of
integers,
and
, the number of questions solved, and the total time taken to solve the questions in seconds.
Output
Output the name of the team which has solved the most problems in the least amount of time.
Example
Input
3
Alice_team
8
3 1324
2 5786
4 4444
8 10023
5 8852
5 6094
3 4433
7 11670
Bob_team
5
7 10746
7 9898
6 7784
6 4343
7 3362
Charlie_team
5
6 10437
6 8834
8 16775
6 9231
7 7224
Output
Bob_team
Alice_team's best results are:
8 10023
7 11670
5 8852
5 6094
4 4444
3 1324
Which sums up to problems solved in
seconds.
Bob_team
has only completed in or less competitions, so all of their scores are summed to
solved questions in
seconds.
Charlie_team
also has only completed in or less competitions, so all of their scores are summed up to
solved questions in
seconds.
Bob_team
and Charlie_team
both have the most amount of questions solved out of anyone, but since Bob_team
has used less total time to solve the same amount of questions, their name is the one that should be engraved.
Comments