Codeforces Global Round 29 (Div. 1 + Div. 2)
B
Multiple Construction
Codeforces
1000
原题
← AC →
翻译中…

You are given an integer $n$. Your task is to construct an array of length $2 \cdot n$ such that:

翻译中…
  • Each integer from $1$ to $n$ appears exactly twice in the array.
  • For each integer $x$ ($1 \le x \le n$), the distance between the two occurrences of $x$ is a multiple of $x$. In other words, if $p_x$ and $q_x$ are the indices of the two occurrences of $x$, $| q_x - p_x |$ must be divisible by $x$.
翻译中…

It can be shown that a solution always exists.

翻译中…

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.

翻译中…

Each of the next $t$ lines contains a single integer $n$ ($1 \le n \le 2 \cdot 10^{5}$).

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^{5}$.

翻译中…

Output

翻译中…

For each test case, print a line containing $2 \cdot n$ integers — the array that satisfies the given conditions.

翻译中…

If there are multiple valid answers, print any of them.

翻译中…

Note

翻译中…
翻译中…

In the first test case:

翻译中…
  • The number $1$ appears at positions $1$ and $3$: the distance is $2$, which is divisible by $1$.
  • The number $2$ appears at positions $2$ and $4$: the distance is $2$, which is divisible by $2$.
翻译中…

In the second test case:

翻译中…
  • The number $1$ appears at positions $1$ and $3$: the distance is $2$, which is divisible by $1$.
  • The number $2$ appears at positions $4$ and $6$: the distance is $2$, which is divisible by $2$.
  • The number $3$ appears at positions $2$ and $5$: the distance is $3$, which is divisible by $3$.
翻译中…

In the third test case, the two occurrences of $1$ are at positions $1$ and $2$, so the distance between them is $1$, which is a multiple of $1$.

翻译中…

样例

Input #1
3
2
3
1
Output #1
1 2 1 2
1 3 1 2 3 2
1 1
InputCopy OutputCopy
题目信息
题号
2147B
时间限制
1 s
内存限制
256 MB
标签
构造

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