QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100

#16520. Permutation

الإحصائيات

Background

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

Given a positive integer $n$.

We define, 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$, $f(\{p_n\})\le f(\{q_n\})$, and output the constructed permutation $\{p_n\}$.

Input

A positive integer $n$.

Output

$n$ integers representing the constructed permutation $\{p_n\}$, separated by spaces.

Any output that satisfies the conditions will be accepted.

Examples

Input 1

4

Output 1

1 4 2 3

Note 1

$f(\{1,4,2,3\})=2$. It can be proven that for any permutation $\{q_n\}$ of $1$ to $n$, $f(\{1,4,2,3\})\le f(\{q_n\})$.

Of course, $\{1,3,2,4\},\{3,1,4,2\},\{4,1,3,2\}$ and others are also valid permutations $\{p_n\}$.

Constraints

For all data, $3 \le n \le 10^6$.

This problem uses bundled testing.

Subtask ID Score $n \le$ Special Properties
$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

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.