407885: GYM102916 I Chess Tournament
Description
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.
InputThe 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.
OutputIn 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.
ExamplesInput4 2Output
3 2 2 3 1 4 2 2 4 3 1 2 1 2 3 4Input
5 2Output
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 1Input
6 2Output
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