CF899C.Dividing the numbers

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Petya has nn integers: 1,2,3,...,n1,2,3,...,n . He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible.

Help Petya to split the integers. Each of nn integers should be exactly in one group.

输入格式

The first line contains a single integer nn ( 2<=n<=600002<=n<=60000 ) — the number of integers Petya has.

输出格式

Print the smallest possible absolute difference in the first line.

In the second line print the size of the first group, followed by the integers in that group. You can print these integers in arbitrary order. If there are multiple answers, print any of them.

输入输出样例

  • 输入#1

    4
    

    输出#1

    0
    2 1 4 
    
  • 输入#2

    2
    

    输出#2

    1
    1 1 
    

说明/提示

In the first example you have to put integers 11 and 44 in the first group, and 22 and 33 in the second. This way the sum in each group is 55 , and the absolute difference is 00 .

In the second example there are only two integers, and since both groups should be non-empty, you have to put one integer in the first group and one in the second. This way the absolute difference of sums of integers in each group is 11 .

首页