Pagini recente » Cod sursa (job #2853620) | Cod sursa (job #940735) | Cod sursa (job #1422865) | Cod sursa (job #1193809) | Cod sursa (job #710430)
Cod sursa(job #710430)
type vec=record
x,y:longint;
end;
type vector=array[1..100000]of vec;
var i,n,dif1,dif2,dif3,dif4,a,b:longint;
minim,max,d,d2:real;
v:vector;
procedure QuickSort(var A: vector; Lo, Hi: Integer);
procedure Sort(l, r: Integer);
var
i, j: integer;
x,y:vec;
begin
i := l; j := r; x := a[(l+r) DIV 2];
repeat
while (a[i].x < x.x)or((a[i].x=x.x)and(a[i].y<x.y)) do i := i + 1;
while (x.x < a[j].x)or((a[j].x=x.x)and(a[j].y>x.y)) do j := j - 1;
if i <= j then
begin
y := a[i]; a[i] := a[j]; a[j] := y;
i := i + 1; j := j - 1;
end;
until i > j;
if l < j then Sort(l, j);
if i < r then Sort(i, r);
end;
begin {QuickSort};
Sort(Lo,Hi);
end;
begin
assign(input,'cmap.in');reset(input);
assign(output,'cmap.out');rewrite(output);
read(n);
minim:=maxlongint;
for i:=1 to n do
read(v[i].x,v[i].y);
Quicksort(v,1,n);
for i:=1 to n-1 do
begin
dif1:=v[i+1].x-v[i].x;
dif2:=abs(v[i].y-v[i+1].y);
d:=sqrt(sqr(dif1)+sqr(dif2));
if d-minim<0.000001 then minim:=d;
end;
writeln(minim:0:6);
close(output)
end.