Codeforces Round 1012 (Div. 2)
D
Simple Permutation
Codeforces
未评级
原题
← CE1 →
翻译中…

Given an integer $n$. Construct a permutation $p_1, p_2, \ldots, p_n$ of length $n$ that satisfies the following property:

翻译中…

For $1 \le i \le n$, define $c_i = \lceil \frac{p_1+p_2+\ldots +p_i}{i} \rceil$, then among $c_1,c_2,\ldots,c_n$ there must be at least $\lfloor \frac{n}{3} \rfloor - 1$ prime numbers.

翻译中…

Input

翻译中…

The first line contains an integer $t$ ($1 \le t \le 10$) — the number of test cases. The description of the test cases follows.

翻译中…

In a single line of each test case, there is a single integer $n$ ($2 \le n \le 10^5)$ — the size of the permutation.

翻译中…

Output

翻译中…

For each test case, output the permutation $p_1,p_2,\ldots,p_n$ of length $n$ that satisfies the condition. It is guaranteed that such a permutation always exists.

翻译中…

Note

翻译中…

In the first test case, $c_1 = \lceil \frac{2}{1} \rceil = 2$, $c_2 = \lceil \frac{2+1}{2} \rceil = 2$. Both are prime numbers.

翻译中…

In the third test case, $c_1 = \lceil \frac{2}{1} \rceil = 2$, $c_2 = \lceil \frac{3}{2} \rceil = 2$, $c_3 = \lceil \frac{6}{3} \rceil = 2$, $c_4 = \lceil \frac{10}{4} \rceil = 3$, $c_5 = \lceil \frac{15}{5} \rceil = 3$. All these numbers are prime.

翻译中…

样例

Input #1
3
2
3
5
Output #1
2 1
2 1 3
2 1 3 4 5
InputCopy OutputCopy
题目信息
题号
2090D
时间限制
2 s
内存限制
256 MB

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