Program strudel;
const
MAXN = 100000;
type elenco=array[0..MAXN] of longint;
var
N, i : longint;
mandorle, cannella, somme, ricordaindice, diff : elenco;
Procedure scambia (var a,b: longint);
var x:longint;
begin
x:=a;
a:=b;
b:=x;
end;
Procedure ordinamento (estremoi,estremos: longint; var v : elenco; var u:elenco; ordinato:boolean);
var inf, sup, medio:longint;
pivot :longint;
begin
inf:=estremoi;
sup:=estremos;
medio:= (estremoi+estremos) div 2;
pivot:=v[medio];
repeat
if (ordinato) then
begin
while (v[inf]<pivot) do inf:=inf+1;
while (v[sup]>pivot) do sup:=sup-1;
end;
if inf<=sup then
begin
scambia(v[inf],v[sup]);
scambia(u[inf],u[sup]);
inf:=inf+1;
sup:=sup-1;
end;
until inf>sup;
if (estremoi<sup) then ordinamento(estremoi,sup,v,u,ordinato);
if (inf<estremos) then ordinamento(inf,estremos,v,u,ordinato);
end;
begin
(*assign(input, 'input.txt'); reset(input);
assign(output, 'output.txt'); rewrite(output);*)
readln( N);
for i:=0 to N-1 do
read(mandorle[i]);
readln;
for i:=0 to N-1 do
read(cannella[i]);
for i:=0 to N-1 do
diff[i]:=cannella[i] - mandorle[i];
for i:=0 to N do
begin
ricordaindice[i]:=i;
somme[i]:=0;
end;
for i:=1 to N do somme[i]:=somme[i-1]+diff[i-1];
for i:=0 to N do write(somme[i],' '); writeln;
for i:=0 to N do write(ricordaindice[i],' '); writeln;
ordinamento(0,N,somme, ricordaindice,true);
for i:=0 to N do write(somme[i],' '); writeln;
for i:=0 to N do write(ricordaindice[i],' '); writeln;
writeln(ricordaindice[N]-ricordaindice[0]);
end.
UHJvZ3JhbSBzdHJ1ZGVsOwpjb25zdAogICAgTUFYTiA9IDEwMDAwMDsKdHlwZSBlbGVuY289YXJyYXlbMC4uTUFYTl0gIG9mIGxvbmdpbnQ7ICAKdmFyCiAgICBOLCBpICAgICAgICAgICAgICAgIDogbG9uZ2ludDsKICAgIG1hbmRvcmxlLCBjYW5uZWxsYSwgc29tbWUsIHJpY29yZGF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