P9578 "Cfz Round 1" Permutation

Background

$1+2+3+\cdots+n=\dfrac {n\times (n+1)} 2$。

Description

Given a positive integer $n$. We define that, for a permutation $\{x_n\}$ of $1$ to $n$, $f(\{x_n\})=\max\limits_{i=1}^{n}(x_i+x_{(i \bmod n)+1})-\min\limits_{i=1}^{n}(x_i+x_{(i \bmod n)+1})$. You need to construct a permutation $\{p_n\}$ of $1$ to $n$ such that for any permutation $\{q_n\}$ of $1$ to $n$, we have $f(\{p_n\})\le f(\{q_n\})$, and output the permutation $\{p_n\}$ you constructed.

Input Format

A positive integer $n$.

Output Format

Output $n$ integers, representing the permutation $\{p_n\}$ you constructed, separated by spaces. Any output that satisfies the condition will be accepted.

Explanation/Hint

#### Sample Explanation #1 $f(\{1,4,2,3\})=2$. It can be proven that for any permutation $\{q_n\}$ of $1$ to $n$, we have $f(\{1,4,2,3\})\le f(\{q_n\})$. Of course, $\{1,3,2,4\}$, $\{3,1,4,2\}$, $\{4,1,3,2\}$, etc. are also valid permutations $\{p_n\}$. #### Constraints For all testdata, $3 \le n \le 10^6$. **This problem uses bundled tests.** | Subtask ID | Points | $n \le$ | Special Property | | :---: | :---: | :---: | :---: | | $1$ | $20$ | $8$ | None | | $2$ | $25$ | $10^6$ | Guaranteed $n \equiv 0 \pmod 2$ | | $3$ | $25$ | $10^6$ | Guaranteed $n \equiv 1 \pmod 2$ | | $4$ | $30$ | $10^6$ | None | Translated by ChatGPT 5