#P10369. 「LAOI-4」Mex Tower (Easy ver.)

    ID: 11185 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>Special JudgeO2优化构造洛谷比赛

「LAOI-4」Mex Tower (Easy ver.)

Background

The difference between this problem and the Hard Version is that this problem requires you to output a valid construction.

Problem Description

Define mex⁡(x,y)\operatorname{mex}(x, y) as the smallest natural number that does not appear in the set {x,y}\{x, y\}. For example, mex⁡(1,5)=0\operatorname{mex}(1, 5) = 0 and mex⁡(3,0)=1\operatorname{mex}(3, 0) = 1.

Next, we define one operation on a natural number sequence a1…ana_1 \dots a_n as replacing sequence aa with a sequence b1…bn−1b_1 \dots b_{n-1} of length n−1\bm{n - 1}, where bi=mex⁡(ai,ai+1)b_i = \operatorname{mex}(a_i, a_{i+1}).

You need to construct a natural number sequence a1…ana_1 \dots a_n of length nn, satisfying 0≤ai≤1090 \leq a_i \leq 10^9, and then perform n−1n - 1 operations on it. Obviously, in the end the sequence aa will have only one number left, and you need to maximize the value of this number.

If there are multiple possible sequences, you may output any valid construction.

Input Format

This problem contains multiple test cases.

The first line contains a positive integer TT, the number of test cases.

For each test case, there is only one line containing a positive integer nn.

Output Format

For each test case, output one line with nn integers, representing the sequence a1…ana_1 \dots a_n you constructed.

3
2
5
7
0 1
3 1 5 0 1
0 7 9 4 0 0 4

Hint

Sample Explanation

For n=2n = 2, after applying the operation to [0,1][0, 1], we will clearly get [2][2]. It can be proven that this is the maximum answer we can obtain.
Other valid outputs such as [1,0][1, 0] can also work.

For n=5n = 5 and n=7n = 7, we cannot give you a clear answer for now.

Constraints

"This problem uses bundled tests"

Subtask\text{Subtask} ∑n≤\sum n \le Special Property Total Score
11 1010 None 55
22 10510^5 A\text{A} 1515
33 B\text{B}
44 5050 n≤25n \le 25 1010
55 10310^3 None 2020
66 10610^6 3535

Special property A\text{A}: it is guaranteed that n≡3(mod4)n \equiv 3 \pmod 4.

Special property B\text{B}: it is guaranteed that n≡2(mod4)n \equiv 2 \pmod 4.

For all testdata, it is guaranteed that 1≤T≤1041 \leq T \leq 10^4, n>1n > 1, and ∑n≤106\sum n \leq 10^6.

Translated by ChatGPT 5