#P1020. 排列 (Permutations)
排列 (Permutations)
Source: CSES Problem Set (Task 1070)
Link: https://cses.fi/problemset/task/1070
Category: Introductory Problems
- Time limit: 1.00 s
- Memory limit: 512 MB
A permutation of integers is called beautiful if there are no adjacent elements whose difference is .
Given , construct a beautiful permutation if such a permutation exists.
Input
The only input line contains an integer .
Output
Print a beautiful permutation of integers . If there are several solutions, you may print any of them. If there are no solutions, print "NO SOLUTION".
Constraints
Example 1
Input:
5
Output:
4 2 5 3 1
Example 2
Input:
3
Output:
NO SOLUTION