CCC '04 S2 - TopYodeller

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Problem type
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 j+1 if j yodellers have a cumulative score higher than their score. Therefore, there may be multiple yodellers at the same rank.

Input Specification

Each test case consists of one TopYodeller competition. The first line of the input contains two integers, n and k; n (2 \le n \le 100) represents the number of yodellers in the competition, and k (1 \le k \le 100) represents the number of yodel rounds in the competition.

Yodellers are assigned contestant numbers from 1 to n.

Next in the input are k lines, each line representing a yodel round.

Each line of input representing a yodel round contains n integers. These n integers give the scores assigned to the n yodellers by the judge. The first integer corresponds to the score given to yodeller number 1, and so forth. The score assigned to a yodeller in any given round is an integer between -1\,000 and 1\,000, inclusive.

Output Specification

For the highest-ranked yodeller at the end of the competition, output Yodeller x is the TopYodeller: score y, worst rank z where x is the contestant number, y is their total score after the competition, and z 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.

Sample Input

5 2
99 97 100 85 -4
95 97 100 62 1000

Sample Output

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.


Comments


  • 1
    nabilbadruzzaman  commented on Sept. 5, 2024, 5:15 p.m.

    Any clues as to why my last test case (most recent submission) is incorrect? Really stumped.


  • 0
    Tofuu  commented on July 27, 2024, 11:49 p.m.

    But would you win?


    • 0
      relx  commented on July 28, 2024, 9:29 p.m.

      Nah, I'd lose.


  • -4
    DerpCheese69  commented on Jan. 16, 2022, 9:26 p.m.

    Could somebody possibly let me know why my 4th test is incorrect?


    • -6
      Spitfire720  commented on Jan. 18, 2022, 12:59 a.m.

      This comment is hidden due to too much negative feedback. Show it anyway.


  • -3
    Xiang_li  commented on Aug. 7, 2021, 8:39 p.m.

    whoops I didn't realize we were ranking the cumulative score


    • -1
      planT_444  commented on Feb. 15, 2022, 2:16 p.m.

      dang


  • -1
    peterqiuchess  commented on Jan. 18, 2021, 10:44 p.m.

    What if there is a tie for the worst rank?


    • 0
      OneYearOld  commented on Feb. 19, 2021, 12:01 a.m. edited

      A yodeller's rank is j+1 if j yodellers have a cumulative score higher than their score.


  • 45
    noYou  commented on July 10, 2020, 9:00 p.m.

    When you yodel so bad your score is negative


  • -10
    andrewguo  commented on Feb. 3, 2020, 4:09 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


    • 17
      Tzak  commented on Feb. 3, 2020, 9:50 p.m.

      If there is a tie for TopYodeller, the output should be one line per winning contestant, listed by increasing competitor number.