#P7978. Champion Tournament Scheduling
Champion Tournament Scheduling
Champion Tournament Scheduling
In this problem, you are given an integer and there are players competing in a tournament that is held in rounds (each round corresponding to a different project). In each project, every player is assigned a distinct strength (ranking) and in every round the top half of the remaining players (according to that project’s ranking) advance, while the rest are eliminated. Before the tournament begins, the principal determines the rankings separately for each of the projects. In addition, he is allowed to choose the order (a permutation of ) in which the projects are held. A player is a potential champion if there exists some choice of the project order (i.e. schedule) so that this player wins every round to become the champion. The principal wishes to design the rankings so that the number of potential champions is as large as possible, and it can be shown that the maximum number is .
Your task is two‐fold:
-
For each project , output a permutation of representing the ranking order (from strongest to weakest). In other words, the first element in the permutation is the player with the highest strength in project , the second element the next strongest, and so on. You must design these rankings such that the top players (which we call the potential champions) are always ranked above the remaining players.
-
For each potential champion (players numbered ), output a permutation of representing a schedule (i.e. the order in which the projects are held) such that when the tournament is simulated the candidate wins every round and becomes champion.
The final output should follow the format below.
Note: All formulas must be written in (\LaTeX) format. The ranking in each project is constructed as follows. Let . For each project (with (1\le i\le n); note that we always have (n\le k) for (n\ge 1)), define the ranking for the potential champions to be a cyclic shift of the identity permutation: [ f_i = [i, i+1, \dots, k, 1,2,\dots,i-1]. ] Then, append the remaining players (from (k+1) to (2^n)) in increasing order.
For each potential champion candidate (x) (with (1\le x\le k)), a valid schedule is given by [ \texttt{schedule}_j = ((x+j)\bmod n)+1, \quad j=0,1,\dots,n-1. ] It can be verified that with these rankings and schedule, if the tournament is simulated as described the candidate will win in every round.
inputFormat
The input consists of a single integer:
n
The integer (n) ((1\le n\le 10) say) is the number of projects (and rounds). There are (2^n) players, numbered from 1 to (2^n).
outputFormat
The output should be formatted as follows:
-
Output (n) lines. The (i)-th line should contain a permutation of ({1,2,\dots,2^n}) representing the ranking order for project (i) (from strongest to weakest). In each ranking the first (2^{n-1}) numbers (potential champions) must appear before all other numbers.
-
Output a line containing the integer (2^{n-1}) — the number of potential champions.
-
Then output (2^{n-1}) additional lines. The (j)-th such line should contain a permutation of ({1,2,\dots,n}) representing a schedule where the corresponding potential champion wins the tournament.
sample
1
1 2
1
1
</p>