304714: CF899C. Dividing the numbers

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Dividing the numbers

题意翻译

将1到n的排列任意划分为两个集合,使他们的和的差绝对值最小,输出差和方案。

题目描述

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 

说明

In the first example you have to put integers $ 1 $ and $ 4 $ in the first group, and $ 2 $ and $ 3 $ in the second. This way the sum in each group is $ 5 $ , and the absolute difference is $ 0 $ . 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 $ 1 $ .

Input

题意翻译

将1到n的排列任意划分为两个集合,使他们的和的差绝对值最小,输出差和方案。

加入题单

算法标签: