题目描述
Read problem statements in [Mandarin], [Bengali], [Russian], and [Vietnamese] as well.
For $a positive, \textbf{even} integer N$, we call a pair of arrays A and B to be interesting if they satisfy the following conditions :
|A| = |B| = N/2 i.e. the length of array A is equal to the length of array B.
Each integer from 1 to N occurs exactly once in exactly one of the arrays.
The i^{th} prefix sum of A is not equal to i^{th} prefix sum of B for all 1 ≤ i ≤ $N/2-1. Formally, \displaystyle \sum_{j = 1}^{i} A_{j} \neq \sum_{j = 1}^{i} B_{j}$ for all 1 ≤ i ≤ N/2 - 1
Sum of all elements in A is equal to sum of all elements in $B i.e. \displaystyle \sum_{j = 1}^{N/2} A_{j} = \sum_{j = 1}^{N/2} B_{j}$
You are given a positive, even integer N. If there exists an interesting pair of arrays, then print "YES" followed by an interesting pair for this given N. If there exists multiple interesting pairs of arrays for given N, you can print any. Print "NO" in a single line if no such pair exists.
------ Input Format ------
- First line of input will contain T, the number of test cases. Then the test cases follow.
- Each test case contains a single line of input, the integer N.
------ Output Format ------
For each test case, if there exists an interesting pair of arrays, say (A, B), then in the first line print "YES", in the second line print array A separated by spaces, and in third line print array B separated by spaces. Print "NO" in a single line if no such pair exists. If there are multiple answers, print any of them.
------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ N ≤ 10^{5}$
$N$ is guaranteed to be even.
- Sum of $N$ over all test cases doesn't exceed $10^{6}$
------ subtasks ------
Subtask 1 (100 points): Original constraints
----- Sample Input 1 ------
2
2
4
----- Sample Output 1 ------
NO
YES
1 4
2 3
----- explanation 1 ------
Test case 2: Consider $A = [1, 4]$ and $B = [2, 3]$. Every integer from $1$ to $4$ occurs exactly once in exactly one of the arrays. Also, $1$st prefix sum of $A$ is not equal to $1$st prefix sum of $B$ ($1 \neq 2$). And sum of the elements is equal to $5$ for both arrays. So, $(A, B)$ is an interesting pair.
输入格式
见题面
输出格式
见题面