Canadian Computing Competition: 2004 Stage 1, Senior #2
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 the round. To keep the judge impartial, each yodeller is assigned a contestant number. Every yodeller competes in every yodel round. After all the yodel 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 (CCC) to write a program which 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 their score. Therefore, there may be multiple yodellers at the same rank.
Each test case consists of one TopYodeller competition. The first line of the input contains two integers, and ; represents the number of yodellers in the competition, and represents the number of yodel rounds in the competition.
Yodellers are assigned contestant numbers from to .
Next in the input are lines, each line representing a yodel round.
Each line of input representing a yodel round contains integers. These integers give the scores assigned to the yodellers by the judge. The first integer corresponds to the score given to yodeller number , and so forth. The score assigned to a yodeller in any given round is an integer between and , inclusive.
For the highest-ranked yodeller 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 rank at any time during the competition. If there is a tie for TopYodeller, the output should be one line per winning contestant, listed by increasing competitor number.
5 2 99 97 100 85 -4 95 97 100 62 1000
Yodeller 5 is the TopYodeller: score 996, worst rank 5
Explanation of Sample Output
After Round 1
Yodeller 3 has score 100, and is ranked 1.
Yodeller 1 has score 99, and is ranked 2.
Yodeller 2 has score 97, and is ranked 3.
Yodeller 4 has score 85, and is ranked 4.
Yodeller 5 has score -4, and is ranked 5.
After Round 2
Yodeller 5 has score 996, and is ranked 1.
Yodeller 3 has score 200, and is ranked 2.
Yodeller 1 has score 194, and is ranked 3.
Yodeller 2 has score 194, and is ranked 3.
Yodeller 4 has score 147, and is ranked 5.