CF1038B.Non-Coprime Partition

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Find out if it is possible to partition the first nn positive integers into two non-empty disjoint sets S1S_1 and S2S_2 such that:

gcd(sum(S1),sum(S2))>1\mathrm{gcd}(\mathrm{sum}(S_1), \mathrm{sum}(S_2)) > 1 Here sum(S)\mathrm{sum}(S) denotes the sum of all elements present in set SS and gcd\mathrm{gcd} means thegreatest common divisor.

Every integer number from 11 to nn should be present in exactly one of S1S_1 or S2S_2 .

输入格式

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

输出格式

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

Otherwise, print "Yes" (quotes for clarity), followed by two lines, describing S1S_1 and S2S_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.

输入输出样例

  • 输入#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 22 and 44 respectively. The gcd(2,4)=2>1\mathrm{gcd}(2, 4) = 2 > 1 , hence that is one of the possible answers.

首页