Chess Tournament
시간 제한2초메모리 제한512 MB
n명이 서로 한 번씩 대결하는 리그전에서 한 라운드에 최대 k개의 경기만 동시에 진행할 수 있을 때, 모든 대진을 마치는 최소 라운드 수와 그 일정을 출력한다.
문제
Alex organizes a chess tournament in his company. The tournament is a round-robin tournament of people, and each pair of players will face each other exactly once.
The problem is, there are only chess boards in the office (). So only games can be played at the same time. Let's call games, being simultaneously played by distinct players, where , a round.
Your task is to help Alex to set a schedule with a minimal number of rounds.
입력
The input contains two integers and () --- the number of players and the number of chess boards.
출력
In the first line output an integer --- the number of rounds.
Then output sections, describing rounds. In the first line of each section, output an integer () --- the number of games in this round. Then output lines with two integers each --- the pairs of players that will play in this round. All these integers must be distinct integers from to .
If there are several possible solutions, output any of them.