시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 2 | 2 | 2 | 100.000% |
Alex organizes a chess tournament in his company. The tournament is a round-robin tournament of $n$ people, and each pair of players will face each other exactly once.
The problem is, there are only $k$ chess boards in the office ($k \le \frac{n}{2}$). So only $k$ games can be played at the same time. Let's call $g$ games, being simultaneously played by $2g$ distinct players, where $1 \le g \le k$, a round.
Your task is to help Alex to set a schedule with a minimal number of rounds.
The input contains two integers $n$ and $k$ ($2 \le n \le 200, 1 \le k \le \frac{n}{2}$) --- the number of players and the number of chess boards.
In the first line output an integer $r$ --- the number of rounds.
Then output $r$ sections, describing rounds. In the first line of each section, output an integer $g$ ($1 \le g \le k$) --- the number of games in this round. Then output $g$ lines with two integers each --- the pairs of players that will play in this round. All these $2g$ integers must be distinct integers from $1$ to $n$.
If there are several possible solutions, output any of them.
4 2
3 2 2 3 1 4 2 2 4 3 1 2 1 2 3 4
5 2
5 2 4 1 2 3 2 1 5 4 2 2 2 5 4 3 2 3 5 2 1 2 5 4 3 1
6 2
8 2 3 2 6 4 2 5 1 4 3 2 6 1 2 5 2 1 3 5 6 2 2 4 5 3 2 4 1 2 6 2 6 3 5 4 1 2 1