CF1038B.Non-Coprime Partition
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Find out if it is possible to partition the first n positive integers into two non-empty disjoint sets S1 and S2 such that:
gcd(sum(S1),sum(S2))>1 Here sum(S) denotes the sum of all elements present in set S and gcd means thegreatest common divisor.
Every integer number from 1 to n should be present in exactly one of S1 or S2 .
输入格式
The only line of the input contains a single integer n ( 1≤n≤45000 )
输出格式
If such partition doesn't exist, print "No" (quotes for clarity).
Otherwise, print "Yes" (quotes for clarity), followed by two lines, describing S1 and S2 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.
输入输出样例
输入#1
1
输出#1
No
输入#2
3
输出#2
Yes 1 2 2 1 3
说明/提示
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 gcd(2,4)=2>1 , hence that is one of the possible answers.