#K82587. Round-Robin Problem Assignment

    ID: 36008 Type: Default 1000ms 256MiB

Round-Robin Problem Assignment

Round-Robin Problem Assignment

You are given n participants and m problems. Your task is to assign a problem to each participant in a round-robin fashion. In other words, for each participant with index i (0-indexed), assign problem number \( (i \bmod m) + 1 \).

If the number of participants exceeds the number of available problems, the assignment repeats cyclically. Otherwise, if \( n \le m \), only the first \( n \) problems are assigned.

This scheduling technique minimizes the overlap and ensures a fair distribution of problems among the participants.

inputFormat

The input is given on a single line containing two integers n and m separated by a space:

  • n - the number of participants.
  • m - the number of problems.

\(1 \leq n, m \leq 10^5\)

outputFormat

Output a single line containing n integers where the i-th integer represents the problem assigned to the i-th participant. The numbers should be separated by a single space.

The assignment follows the formula: \( problem_i = (i \bmod m) + 1 \).

## sample
7 3
1 2 3 1 2 3 1

</p>