|
Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Translated by Muhamed Keta.
Football Championship
Question:
In a certain football championship there are n teams.
Every season, every
team has a match with any other team exactly once.
A season consists of $n - 1$ turns. It’s a way of
doing things for a team not to have two consecutive
matches in the same place (home, or away). Frankly
this isn’t always possible. They didn’t have any idea
what to do so they sought your help to minimize the
number of consecutive times every squad plays at the same
position, and give them a possible calendar for their
next championship.
Input specification
A number n, denoting the number of teams playing
where 2 ≤ n ≤ 1000; and n is even
Output specification
On the first line, show the minimum number of
matches the squads can play consecutively on
different positions.
On the next n - 1 lines show any possible calendar
which satisfies the previously calculated number.
Each line consists of n/2 pairs of numbers 1...n,
denoting the teams. Each of these pairs of form
(u, v) means that team U, plays home and team V
plays away.
Sample Input I
2
|
Sample Input II
4
|
Sample Output I
0
1 2
|
Sample Output II
2
1 2 3 4
1 4 2 3
1 3 4 2
|
Для отправки решений необходимо выполнить вход.
|