TopYodeller
InterviewTime limit1sMemory limit128 MB
Compute each yodeller's cumulative score after every round, find who ends with the highest total, and report their worst rank.
- Level
Easy3 of 10
- Topics
- Array, Simulation, Sorting
- Solved
- No attempts yet
Problem
A yodel is a wordless song that shifts suddenly from a normal voice to a high, falsetto voice and back. Yodeling, present in many Swiss folk songs, is commonly heard throughout the Alps.
The TopYodeller contest invites the world's best yodellers to compete for a share of 100,000 Swiss Francs, with the best yodeller receiving 50,000 Francs. Each yodeller competes in a series of yodel rounds and is assigned a score by the judge for their performance in each round. To keep the judge impartial, each yodeller is assigned a contestant number. Every yodeller competes in every round. After all the rounds are complete, the yodeller with the highest total score is declared the TopYodeller.
You have been hired by the TopYodeller Contest Co-ordinating Committee to write a program that generates a scoreboard so that yodel fans around the world can track the progress of the best yodellers on the Internet.
After each round, each yodeller's cumulative score is calculated and a rank is assigned. A yodeller's rank is if yodellers have a cumulative score higher than theirs. Therefore, there may be multiple yodellers at the same rank.
Input
The input describes one TopYodeller competition. The first line contains two integers and : is the number of yodellers, and is the number of rounds.
Yodellers are assigned contestant numbers from to .
The next lines each represent one round. Each such line contains integers giving the scores the judge assigned to the yodellers: the first integer is the score of yodeller , the second is the score of yodeller , and so on. Each score is an integer between and , inclusive.
Output
For the highest-ranked yodeller (the one with the highest total score) at the end of the competition, output:
Yodeller x is the TopYodeller: score y, worst rank z
where is the contestant number, is their total score after the competition, and is their worst (largest) rank at any time during the competition. If there is a tie for TopYodeller, output one line per winning contestant, in increasing order of contestant number.
Hint
For the example above, the ranks change as follows.
After Round 1
- Yodeller has score and is ranked .
- Yodeller has score and is ranked .
- Yodeller has score and is ranked .
- Yodeller has score and is ranked .
- Yodeller has score and is ranked .
After Round 2
- Yodeller has score and is ranked .
- Yodeller has score and is ranked .
- Yodeller has score and is ranked .
- Yodeller has score and is ranked .
- Yodeller has score and is ranked .
Yodeller has the highest final total, so they are the TopYodeller; their worst rank during the competition was th, in Round 1.