P17764 「LDOI R2」极差 / Range
Description
Define the **range** of a sequence as the maximum value in the sequence minus the minimum value in the sequence.
You need to construct two permutations $a,b$ of length $n$ such that every subinterval of $a$ of length greater than $1$ has **range** greater than $1$, every subinterval of $b$ of length greater than $1$ has **range** greater than $1$, and for each position $i$, the absolute difference between $a_i$ and $b_i$ is greater than $1$.
Formally, it must satisfy the following conditions:
+ $\forall1 \le l < r \le n$, $\max_{i=l}^r a_i - \min_{i=l}^r a_i > 1$.
+ $\forall1 \le l < r \le n$, $\max_{i=l}^r b_i - \min_{i=l}^r b_i > 1$.
+ $\forall1 \le i \le n$, $|a_i - b_i| > 1$.
If no such permutations exist, output $-1$.
Input Format
The input consists of a single positive integer $n$.
Output Format
If no such permutations exist, output $-1$.
Otherwise, output two lines, each containing $n$ positive integers representing permutations $a$ and $b$.
Explanation/Hint
### Constraints
**This problem uses subtask scoring, and subtask dependency is enabled.**
| Subtask | $n \le$ | Score | Dependencies |
|:-:|:-:|:-:|:-:|
| $1$ | $9$ | $30$ | None |
| $2$ | $10^3$ | $30$ | $1$ |
| $3$ | $10^6$ | $40$ | $1,2$ |
For all test cases, $1 \le n \le 10^6$.