CSES - Permutations | Hoán vị

View as PDF



Authors:
Problem types
Points: 1100 (p) Time limit: 1.0s Memory limit: 512M Input: stdin Output: stdout

A permutation of integers ~1, 2, \ldots, n~ is called beautiful if there are no adjacent elements whose difference is ~1~.

Given ~n~, construct a beautiful permutation if such a permutation exists.

Input

  • The only input line contains an integer ~n~.

Output

  • Print a beautiful permutation of integers ~1, 2, \ldots, n~. If there are several solutions, you may print any of them. If there are no solutions, print NO SOLUTION.

Constraints

  • ~1 \le n \le 10^6~

Example

Sample input 1

5

Sample output 1
4 2 5 3 1

Sample input 2

3

Sample output 2
NO SOLUTION


Comments (5)

Most recent
Loading comments...