CCC '97 S3 - Double Knockout Competition

View as PDF

Submit solution

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

Problem types

In a number of sports, a championship may be determined by a double knockout competition. A team is eliminated on its second loss, so the winner is the last remaining team with one or fewer losses. The competition is played in a series of rounds: in each round, teams that have not been eliminated are paired subject to the constraint that an undefeated team never plays a team with one loss. As many teams as possible are paired in each round. After a number of rounds only two teams remain. These teams play in a round by themselves, although one is undefeated and the other is not. If neither is eliminated, they play again in a final round. For our analysis we assume that this extra round is always necessary.

Write a program to report on a Double Knockout Competition.

Input Specification

The first line of input contains one positive integer n which is the number of test cases which follow it. The next n lines each contain one positive integer t, 2 \le t < 32\,768, which is the number of teams in the competition for that test case.

Output Specification

For each case there should be an initial line which has the form:

Round 0: 2 undefeated, 0 one-loss, 0 eliminated

This is followed by a similar line for each round of the competition, followed by a single line saying how many rounds were played. The output for different test cases is to be separated by a single blank line.

Sample Input

1
2

Sample Output

Round 0: 2 undefeated, 0 one-loss, 0 eliminated
Round 1: 1 undefeated, 1 one-loss, 0 eliminated
Round 2: 0 undefeated, 2 one-loss, 0 eliminated
Round 3: 0 undefeated, 1 one-loss, 1 eliminated
There are 3 rounds.

Comments


  • 0
    ilovepotions  commented on May 21, 2024, 1:30 a.m.

    Can someone check my latest submission and help me find my error? I've double checked with the official test data and have found literally 0 differences with my output (checked with a website too)


    • 0
      try_my_hardest  commented on May 21, 2024, 9:13 p.m.

      You have to output an extra newline between each testcase. This does not include the last testcase, since there are no more testcases after it


  • 1
    踏雪寻梅  commented on May 19, 2024, 4:44 p.m. edited

    My code has an issue, or is it the checker that's malfunctioning? Keeps telling me to check white spaces X_X


    • 0
      try_my_hardest  commented on May 20, 2024, 7:16 p.m.

      I think it's because you have to output an extra newline between each testcase


      • 0
        踏雪寻梅  commented on May 20, 2024, 8:22 p.m.

        LOL, I output a additional blank line in the last test case. I'm such a fool. φ(゜▽゜*)♪


  • 2
    Tinyfold  commented on Nov. 25, 2023, 10:03 p.m.

    Hi, I got a presentation error. I checked the whitespace and it was correct. How to fix? Thanks


  • 0
    maxcruickshanks  commented on Dec. 19, 2022, 3:59 a.m.

    Since the checker was not implemented properly, it was fixed, and all submissions were rejudged.