#H2026L. Let the Bullet Fly
Let the Bullet Fly
Problem Description
Given a positive integer . You need to construct a permutation of length (i.e., each integer from to appears exactly once) such that for all :
That is, after pairing the elements into pairs, the absolute difference of the -th pair modulo must be equal to .
Please output any valid construction, or report that no such permutation exists.
Input
The input contains a single integer ().
Output
If no such permutation exists, output a single line containing -1.
Otherwise, output a single line containing integers , representing your constructed permutation. If there are multiple valid constructions, you may output any of them.
Examples
Example 1
Input
3
Output
1 5 2 4 3 6
Explanation
Check the pairs:
- Pair 1: ✓
- Pair 2: ✓
- Pair 3: ✓
Example 2
Input
4
Output
7 8 2 4 3 6 1 5
Explanation
Check the pairs:
- Pair 1: ✓
- Pair 2: ✓
- Pair 3: ✓
- Pair 4: ✓
Example 3
Input
2
Output
-1
Explanation
When (here ), no valid permutation exists, so we output -1.
Constraints
相关
在下列比赛中: