Upload code_segments/segment_217.txt with huggingface_hub
Browse files
    	
        code_segments/segment_217.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            There is an integer sequence $a$ of length $n$, where each element is initially $-1$.
         
     | 
| 2 | 
         
            +
             
     | 
| 3 | 
         
            +
            Misuki has two typewriters where the first one writes letters from left to right, with a pointer initially pointing to $1$, and another writes letters from right to left with a pointer initially pointing to $n$.
         
     | 
| 4 | 
         
            +
             
     | 
| 5 | 
         
            +
            Misuki would choose one of the typewriters and use it to perform the following operations until $a$ becomes a permutation of $[1, 2, \ldots, n]$
         
     | 
| 6 | 
         
            +
             
     | 
| 7 | 
         
            +
              * write number: write the minimum positive integer that isn't present in the array $a$ to the element $a_i$, $i$ is the position where the pointer points at. Such operation can be performed only when $a_i = -1$.    * carriage return: return the pointer to its initial position (i.e. $1$ for the first typewriter, $n$ for the second)    * move pointer: move the pointer to the next position, let $i$ be the position the pointer points at before this operation, if Misuki is using the first typewriter, $i := i + 1$ would happen, and $i := i - 1$ otherwise. Such operation can be performed only if after the operation, $1 \le i \le n$ holds. 
         
     | 
| 8 | 
         
            +
             
     | 
| 9 | 
         
            +
            Your task is to construct any permutation $p$ of length $n$, such that the minimum number of carriage return operations needed to make $a = p$ is the same no matter which typewriter Misuki is using.
         
     | 
| 10 | 
         
            +
             
     | 
| 11 | 
         
            +
            Each test contains multiple test cases. The first line of input contains a single integer $t$ ($1 \le t \le 500$) — the number of test cases. The description of the test cases follows.
         
     | 
| 12 | 
         
            +
             
     | 
| 13 | 
         
            +
            The first line of each test case contains a single integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the length of the permutation.
         
     | 
| 14 | 
         
            +
             
     | 
| 15 | 
         
            +
            It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.
         
     | 
| 16 | 
         
            +
             
     | 
| 17 | 
         
            +
            For each test case, output a line of $n$ integers, representing the permutation $p$ of length $n$ such that the minimum number of carriage return operations needed to make $a = p$ is the same no matter which typewriter Misuki is using, or $-1$ if it is impossible to do so.
         
     | 
| 18 | 
         
            +
             
     | 
| 19 | 
         
            +
            If there are multiple valid permutations, you can output any of them.
         
     | 
| 20 | 
         
            +
             
     | 
| 21 | 
         
            +
            In the
         
     |