#C1571. Tournament Simulation

    ID: 44791 Type: Default 1000ms 256MiB

Tournament Simulation

Tournament Simulation

This problem involves simulating a tournament where in each round the competitors are paired up, and only the competitor in the left position in each pair wins and advances to the next round. The tournament continues until only one competitor remains.

Formally, given an integer \(N\) and a list of \(N\) integers representing the participants, the tournament is simulated round by round. In each round, the winners are chosen as follows:

For a current round with a list \(A = [a_0, a_1, a_2, \dots, a_{k-1}]\), the winners are determined by selecting \(a_0, a_2, a_4, \dots\). The process is repeated until only one number remains. The output is the list of winners at the end of every round.

For example, if \(N=8\) and the participants are [10, 20, 30, 40, 50, 60, 70, 80], the simulation produces the rounds:

  • Round 1: [10, 30, 50, 70]
  • Round 2: [10, 50]
  • Round 3: [10]

Note: All formulas are expressed in \(\LaTeX\) format.

inputFormat

The first line contains an integer \(N\) representing the number of participants. The second line contains \(N\) space-separated integers representing the participants.

outputFormat

Output the winners of each round in separate lines. In each line, print the winners (space-separated integers) of that round.

## sample
8
10 20 30 40 50 60 70 80
10 30 50 70

10 50 10

</p>