Pagini recente » Cod sursa (job #1110404) | Cod sursa (job #849988) | Cod sursa (job #378267) | Cod sursa (job #368050) | Cod sursa (job #110626)
Cod sursa(job #110626)
#include <stdio.h>
#include <math.h>
int first[750001], second[250001];
int main()
{
freopen("multimi2.in", "r", stdin);
freopen("multimi2.out", "w", stdout);
int i, n, goal;
scanf("%d", &n);
for(i = n; i >= 4; i -= 4)
{
first[++first[0]] = i;
first[++first[0]] = i - 3;
second[++second[0]] = i - 2;
second[++second[0]] = i - 1;
}
if(n % 4 == 3)
{
first[++first[0]] = 3;
second[++second[0]] = 2;
second[++second[0]] = 1;
}
if(n % 4 == 2)
{
first[++first[0]] = 1;
second[++second[0]] = 2;
}
if(n % 4 == 1)
{
first[++first[0]] = 1;
}
if(2 * (n * (n + 1)) / 4 == n * (n + 1) / 2)
{
printf("0\n");
}
else
{
printf("1\n");
}
printf("%d\n", first[0]);
for(i = 1; i <= first[0]; ++i)
{
printf("%d ", first[i]);
}
printf("\n%d\n", second[0]);
for(i = 1; i <= second[0]; ++i)
{
printf("%d ", second[i]);
}
return 0;
}