#C2270. Non-divisible Subset Sum Sequence Generator
Non-divisible Subset Sum Sequence Generator
Non-divisible Subset Sum Sequence Generator
You are given three positive integers M, L, and D. Your task is to generate a sequence of M distinct integers such that for every subset of exactly L distinct integers taken from the sequence, the sum of the subset is not divisible by D.
In other words, if you denote the sequence as \(a_0, a_1, \ldots, a_{M-1}\), then for every combination \(\{a_{i_1}, a_{i_2}, \ldots, a_{i_L}\}\) (with all indices distinct), it must hold that:
[ a_{i_1} + a_{i_2} + \cdots + a_{i_L} \not\equiv 0 \pmod{D} ]
The problem requires you to come up with a method to construct such a sequence. It is guaranteed that at least one valid sequence exists for the given constraints.
inputFormat
The input consists of a single line containing three space-separated positive integers: M, L, and D.
Constraints:
- 1 ≤ M ≤ 105 (or as specified in the problem limits)
- 1 ≤ L ≤ M
- D is a positive integer
outputFormat
Output a single line containing M space-separated integers representing the generated sequence that satisfies the condition.
## sample5 3 13
1 100005 200009 300010 400014