Codeforces Round 508 (Div. 2)
B
Non-Coprime Partition
Codeforces
1100
原题
← AC →
翻译中…

Find out if it is possible to partition the first $n$ positive integers into two non-empty disjoint sets $S_1$ and $S_2$ such that:

翻译中…

$\mathrm{gcd}(\mathrm{sum}(S_1), \mathrm{sum}(S_2)) \gt 1$

翻译中…

Here $\mathrm{sum}(S)$ denotes the sum of all elements present in set $S$ and $\mathrm{gcd}$ means thegreatest common divisor.

翻译中…

Every integer number from $1$ to $n$ should be present in exactly one of $S_1$ or $S_2$.

翻译中…

Input

翻译中…

The only line of the input contains a single integer $n$ ($1 \le n \le 45\,000$)

翻译中…

Output

翻译中…

If such partition doesn't exist, print "No" (quotes for clarity).

翻译中…

Otherwise, print "Yes" (quotes for clarity), followed by two lines, describing $S_1$ and $S_2$ respectively.

翻译中…

Each set description starts with the set size, followed by the elements of the set in any order. Each set must be non-empty.

翻译中…

If there are multiple possible partitions — print any of them.

翻译中…

Note

翻译中…

In the first example, there is no way to partition a single number into two non-empty sets, hence the answer is "No".

翻译中…

In the second example, the sums of the sets are $2$ and $4$ respectively. The $\mathrm{gcd}(2, 4) = 2 \gt 1$, hence that is one of the possible answers.

翻译中…

样例

Input #1
1
Output #1
No
InputCopy OutputCopy
Input #2
3
Output #2
Yes
1 2
2 1 3
InputCopy OutputCopy
题目信息
题号
1038B
时间限制
2 s
内存限制
256 MB
标签
构造
数学

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