program ideone;
Const smax = 99;
Type simple = array[0..smax] of smallint;
Var data:simple; i, n, indMax1, indMax2, indMin1, indMin2:smallint;
procedure writeArr(data:simple);
Var i:smallint;
begin
for i:=0 to n-1 do write(data[i], ' ');
writeln();
end;
function bubbleSort(data:simple):simple;
Var i, j, t:smallint;
begin
for i:=0 to n-1 do
for j:=0 to n-2 do
if data[j]>data[j+1] then begin
t:=data[j];
data[j]:=data[j+1];
data[j+1]:=t;
end;
bubbleSort:=data;
end;
procedure distance(data:simple);
Var i, j:smallint; sort:simple;
begin
sort:=bubbleSort(data);
writeArr(sort);
writeln('=========');
for i:=0 to n-2 do begin
for j:=i+1 to n-1 do
if abs(data[i]-data[j])<abs(data[indMin1]-data[indMin2]) then begin
indMin1:=i;
indMin2:=j;
end;
if abs(sort[i]-sort[i+1])>abs(sort[indMax1]-sort[indMax1+1]) then begin
indMax1:=i;
indMax2:=i+1;
end;
end;
end;
begin
indMax1:=0;
indMax2:=1;
indMin1:=0;
indMin2:=1;
read(n);
for i:=0 to n-1 do read(data[i]);
distance(data);
writeln(abs(data[indMax1]-data[indMax2]), ' ', indMax1+1, ' ', indMax2+1);
writeln(abs(data[indMin1]-data[indMin2]), ' ', indMin1+1, ' ', indMin2+1);
end.
cHJvZ3JhbSBpZGVvbmU7CgpDb25zdCBzbWF4ID0gOTk7ClR5cGUgc2ltcGxlID0gYXJyYXlbMC4uc21heF0gb2Ygc21hbGxpbnQ7ClZhciBkYXRhOnNpbXBsZTsgaSwgbiwgaW5kTWF4MSwgaW5kTWF4MiwgaW5kTWluMSwgaW5kTWluMjpzbWFsbGludDsKCnByb2NlZHVyZSB3cml0ZUFycihkYXRhOnNpbXBsZSk7ClZhciBpOnNtYWxsaW50OwpiZWdpbgoJZm9yIGk6PTAgdG8gbi0xIGRvIHdyaXRlKGRhdGFbaV0sICcgJyk7Cgl3cml0ZWxuKCk7CmVuZDsKCmZ1bmN0aW9uIGJ1YmJsZVNvcnQoZGF0YTpzaW1wbGUpOnNpbX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