You are given three integers $n$, $m$, and $k$, where $m \cdot k \lt n$.
For a sequence $b$ consisting of non-negative integers, define $f(b)$ as follows:
- You may perform the following operation on
$b$: - Let
$l$denote the current length of$b$. Choose a positive integer$1 \leq i \leq l - k + 1$, remove the subarray from index$i$to$i + k - 1$and concatenate the remaining parts. In other words, replace$b$with$$[b_1, b_2, \ldots, b_{i - 1}, b_{i + k}, b_{i + k + 1}, \ldots, b_l].$$ $f(b)$is defined as the minimum possible value of$\operatorname{mex}(b)$$^{\text{∗}}$after performing the above operation at most$m$times (possibly zero).
You need to construct a sequence $a$ of length $n$ consisting of non-negative integers, such that:
- For all
$1 \le i \le n$,$0 \le a_i \le 10^9$. - Over all such sequences
$a$,$f(a)$is maximized.
$^{\text{∗}}$The minimum excluded (MEX) of a collection of integers $c_1, c_2, \ldots, c_k$ is defined as the smallest non-negative integer $x$ which does not occur in the collection $c$.
Input
Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.
The first line of each test case contains three integers $n$, $m$, and $k$ ($2 \le n \le 2 \cdot 10^5$, $1 \le m \lt n$, $1 \le k \lt n$, $1 \le m \cdot k \lt n$).
It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.
Output
For each test case, output $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 10^9$).
If there are multiple answers, print any of them.
Note
In the first test case, it can be shown that $f(a) = 1$, which is maximized.
In the second test case, it can be shown that $f(a) = 1$, which is maximized. $f(a) = 1$ since you can perform the following operations:
- Choose
$i = 3$, remove the subarray from index$3$to$4$and concatenate the remaining parts. The sequence$a$becomes$[0, 1, 0]$. - Choose
$i = 1$, remove the subarray from index$1$to$2$and concatenate the remaining parts. The sequence$a$becomes$[0]$.
In the third test case, it can be shown that $f(a) = 2$, which is maximized. $f(a) = 2$ since you can perform the following operation:
- Choose
$i = 2$, remove the subarray from index$2$to$5$and concatenate the remaining parts. The sequence$a$becomes$[0, 1]$.
In the fourth test case, it can be shown that $f(a) = 2$, which is maximized.
In the fifth test case, it can be shown that $f(a) = 3$, which is maximized.
In the sixth test case, it can be shown that $f(a) = 2$, which is maximized.
样例
8
2 1 1
5 2 2
6 1 4
8 2 2
8 1 5
11 3 3
22 6 3
17 2 2
0 0
0 1 0 0 0
0 1 2 2 0 1
0 2 1 0 1 0 8 1
0 1 2 1000000000 1 0 1 2
1 0 0 1 0 2 1 0 2 1 0
0 2 1 0 2 1 0 3 2 1 0 2 1 0 2 1 0 2 1 0 2 1
4 0 2 1 3 4 0 2 1 0 3 4 0 1 2 1 3
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。