#C879. Seating Arrangement for Participants
Seating Arrangement for Participants
Seating Arrangement for Participants
You are given n participants and m tables. Your task is to arrange the participants at the tables such that:
- Each table receives either ⌊n/m⌋ or ⌊n/m⌋+1 participants.
- The first n \mod m tables will receive one extra participant.
- In each table's seating arrangement, the first number denotes the number of participants at that table followed by the participant numbers assigned to that table.
For example, if n = 6 and m = 3, then each table gets exactly 2 participants. The seating arrangement will be:
2 1 2 2 3 4 2 5 6
Note: Participant numbers are assigned in increasing order from 1 to n.
inputFormat
The input consists of one line containing two integers n and m separated by a space, where:
- n (1 ≤ n ≤ 105) is the number of participants.
- m (1 ≤ m ≤ n) is the number of tables.
outputFormat
Output m lines. Each line represents a table. The line starts with an integer k which is the number of participants at that table, followed by k participant numbers. All numbers are separated by a space.
## sample6 3
2 1 2
2 3 4
2 5 6
</p>