Pagini recente » Cod sursa (job #2381029) | Cod sursa (job #36995) | Cod sursa (job #2585686) | Cod sursa (job #127027) | Cod sursa (job #111182)
Cod sursa(job #111182)
var f1,f2:text;
i,j,ic,ic1,ic2,n,a1,a2:longint;
v1,v2:array[1..1000000] of longint;
begin
assign(f1,'multimi2.in');
reset(f1);
assign(f2,'multimi2.out');
rewrite(f2);
read(f1,n);
i:=n;
if (n mod 4=0)or(n mod 4=3) then
writeln(f2,0)
else writeln(f2,1);
while i>0 do
begin
j:=(j+1) mod 2;
if j=0 then
begin
a1:=i;
a2:=i-1;
dec(i,2);
end
else
begin
a1:=i-1;
a2:=i;
dec(i,2);
end;
inc(ic);
if a1<>0 then
begin
ic1:=ic;
v1[ic1]:=a1;
end;
if a2<>0 then
begin
ic2:=ic;
v2[ic2]:=a2;
end;
end;
writeln(f2,ic1);
for i:=ic1 downto 2 do
write(f2,v1[i],' ');
writeln(f2,v1[1]);
writeln(f2,ic2);
for i:=ic2 downto 2 do
write(f2,v2[i],' ');
writeln(f2,v2[1]);
close(f1);
close(f2);
end.