408326: GYM103098 B Beautiful Permutation

Memory Limit:0 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Beautiful Permutationtime limit per test1 secondmemory limit per test512 mebibytesinputstandard inputoutputstandard output

A permutation $$$a_0, a_1, \ldots, a_{n - 1}$$$ of $$$0, 1, \ldots, n - 1$$$ is said to be beautiful if the sequence $$$b_0, \ldots, b_{n - 1}$$$ defined as $$$b_i = |a_i - i|$$$ is also a permutation of $$$0, \ldots, n - 1$$$.

Given $$$n$$$, construct a beautiful permutation of $$$n$$$ elements or determine that it does not exist.

Input

The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^6$$$): the size of the permutation.

Output

If there is no beautiful permutation of $$$n$$$ elements, output a single line with the word "NO".

Otherwise, on the first line, print "YES", and on the second line, print $$$n$$$ space-separated integers $$$a_0, \ldots, a_{n-1}$$$: the beautiful permutation. If there are multiple beautiful permutations, print any one of them.

ExamplesInput
4
Output
YES
3 0 2 1
Input
3
Output
NO
Input
1
Output
YES
0

加入题单

上一题 下一题 算法标签: