题库练习 Dividing the numbers
← 上一题 下一题 →

A11381 | Dividing the numbers

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Petya has $n$ integers: $1,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 $n$ integers should be exactly in one group.

输入格式

The first line contains a single integer $n$ ( $2<=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 
C++ 编辑器
输入
输出