Codeforces Round 922 (Div. 2)
G
Permutation of Given
Codeforces
2700
原题
← F→
翻译中…

You were given only one number, $n$. It didn't seem interesting to you, so you wondered if it's possible to come up with an array of length $n$ consisting of non-zero integers, such that if each element of the array is replaced by the sum of its neighbors (the elements on the ends are replaced by their only neighbors), you obtain a permutation of the numbers in the original array.

翻译中…

Input

翻译中…

Each test case contains only one number, $n$ ($2 \leq n \leq 10^6$).

翻译中…

Output

翻译中…

If a solution exists, output "YES" (without quotes), followed by an array $a$ ($-10^9 \leq a_i \leq 10^9, a_i \neq 0$) that satisfies the condition of the problem. If there are multiple possible answers, output any of them.

翻译中…

If there is no suitable array, output "NO" (without quotes).

翻译中…

The words "YES" and "NO" can be output in any case, for example, "YES", "Yes", "yEs", and so on.

翻译中…

Note

翻译中…

In the first test, the array [$1, 2, -2, -1$] is suitable, because if each element is replaced by the sum of its neighbors, the resulting array is [$2, -1, 1, -2$], which is a permutation of the original array.

翻译中…

In the second test, it can be shown that there is no solution.

翻译中…

样例

Input #1
4
Output #1
YES
1 2 -2 -1
InputCopy OutputCopy
Input #2
5
Output #2
NO
InputCopy OutputCopy
题目信息
题号
1918G
时间限制
1 s
内存限制
256 MB
标签
构造
数学

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