Codeforces Round 455 (Div. 2)
F
AND-permutations
Codeforces
2500
原题
← E→
翻译中…

Given an integer $*N*$, find two permutations:

翻译中…
  1. Permutation $*p*$ of numbers from 1 to $*N*$ such that $*p*_{*i*} ≠ *i*$ and $*p*_{*i*} & *i* = 0$ for all $*i* = 1, 2, ..., *N*$.
  2. Permutation $*q*$ of numbers from 1 to $*N*$ such that $*q*_{*i*} ≠ *i*$ and $*q*_{*i*} & *i* ≠ 0$ for all $*i* = 1, 2, ..., *N*$.
翻译中…
翻译中…

Input

翻译中…

The input consists of one line containing a single integer $*N*$ ($1 ≤ *N* ≤ 10^{5}$).

翻译中…

Output

翻译中…

For each subtask, if the required permutation doesn't exist, output a single line containing the word "NO"; otherwise output the word "YES" in the first line and $*N*$ elements of the permutation, separated by spaces, in the second line. If there are several possible permutations in a subtask, output any of them.

翻译中…

样例

Input #1
3
Output #1
NO
NO
InputCopy OutputCopy
Input #2
6
Output #2
YES
6 5 4 3 2 1
YES
3 6 2 5 1 4
InputCopy OutputCopy
题目信息
题号
909F
时间限制
2 s
内存限制
256 MB
标签
构造

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。