### 1997 Canadian Computing Competition, Stage 1

## Problem C: Double Knockout Competition

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 is 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. See the input and output specifications below.

### Input

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`, `t` < 32768, which is
the number of teams in the competition for that test case.

### Output

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 my 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.

All Submissions

Best Solutions

**Point Value:** 10

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** Sep 28, 2008

**Problem Types:**[Show]

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

silverstunton Sep 06, 2011 - 3:02:53 am UTC one questionWhat happens to the extra team?

Danielon Sep 06, 2011 - 3:57:13 am UTC Re: one question