#C9752. Mirror Sequence Generation

    ID: 53880 Type: Default 1000ms 256MiB

Mirror Sequence Generation

Mirror Sequence Generation

The task is to generate a mirror sequence for a given positive integer \(N\). The mirror sequence is constructed as follows: for each integer \(i\) from 1 to \(\lfloor N/2 \rfloor\), append \(i\) and \(-i\) to the sequence. If \(N\) is odd, append \(\lfloor N/2 \rfloor + 1\) as the final element.

For example, when \(N = 5\), the mirror sequence is: [1, -1, 2, -2, 3]. Use the formula: \[ \text{mirror_sequence}(N) = \begin{cases} [1, -1, 2, -2, \dots, \lfloor N/2 \rfloor, -\lfloor N/2 \rfloor] & \text{if } N \text{ is even} \\ [1, -1, 2, -2, \dots, \lfloor N/2 \rfloor, -\lfloor N/2 \rfloor, \lfloor N/2 \rfloor + 1] & \text{if } N \text{ is odd} \end{cases} \]

inputFormat

The first line of input contains a single integer (T) representing the number of test cases. Each of the following (T) lines contains a single integer (N), for which you are to generate the mirror sequence.

outputFormat

For each test case, print the mirror sequence on a separate line. The numbers in each sequence must be separated by a single space.## sample

4
1
2
5
10
1

1 -1 1 -1 2 -2 3 1 -1 2 -2 3 -3 4 -4 5 -5

</p>