http://codeforces.com/contest/899/problem/C
1到N,分成两组,使得差的绝对值最小。输出绝对值,以及第一组数的数量和数据。
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int n;
cin >> n;
ll s=(ll)(n+1)*n/2;
s=(s+1)/2;
ll tot=0,w=0;
ll ans[60005];
for (int i=n;i>=1;i--){
if (s>=i){
s-=i;
ans[++tot]=i;
w+=i;
}
}
cout << abs((ll)(n+1)*n/2-2*w) << endl;
cout << tot ;
for (int i=tot;i>=1;i--){
cout << " " << ans[i] ;
}
}