Codeforces Round 455 (Div. 2)
翻译中…
Given an integer $*N*$, find two permutations:
翻译中…
- Permutation
$*p*$of numbers from 1 to$*N*$such that$*p*_{*i*} ≠ *i*$and$*p*_{*i*} & *i* = 0$for all$*i* = 1, 2, ..., *N*$. - Permutation
$*q*$of numbers from 1 to$*N*$such that$*q*_{*i*} ≠ *i*$and$*q*_{*i*} & *i* ≠ 0$for all$*i* = 1, 2, ..., *N*$.
翻译中…
$&$ is the bitwise AND operation.
翻译中…
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
题目信息
标签
构造
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。