Hacktoberfest-2021 icon indicating copy to clipboard operation
Hacktoberfest-2021 copied to clipboard

CSES_Permutations

Open AdiTyaa-Raj opened this issue 3 years ago • 1 comments

A permutation of integers 1,2,…,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,…,n. If there are several solutions, you may print any of them. If there are no solutions, print "NO SOLUTION".

Constraints 1≤n≤106 Example 1

Input: 5

Output: 4 2 5 3 1

Example 2

Input: 3

Output: NO SOLUTION

AdiTyaa-Raj avatar Oct 20 '21 13:10 AdiTyaa-Raj

Please assign this issue to me in c++ language

AdiTyaa-Raj avatar Oct 20 '21 13:10 AdiTyaa-Raj