Teza Round 1 (Codeforces Round 1015, Div. 1 + Div. 2)
D
Arcology On Permafrost
Codeforces
1600
原题
← CE →
翻译中…

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.

翻译中…

样例

Input #1
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
Output #1
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
InputCopy OutputCopy
题目信息
题号
2084D
时间限制
2 s
内存限制
256 MB
标签
二分
暴力
构造
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。