比赛 |
20110724 |
评测结果 |
C |
题目名称 |
遥远的距离 |
最终得分 |
0 |
用户昵称 |
老虎小飞 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2011-07-24 12:18:17 |
显示代码纯文本
var
x,y:array[0..1,0..100000]of longint;
i,n,m,t,k:longint;
ans,ans0,max:int64;
procedure suan;
var
a,b,a0,b0,i:longint;
max,tmp:int64;
begin
a:=random(n)+1;
b:=0;
repeat
a0:=a;b0:=b; max:=0;
for i:=1 to m do begin
tmp:=sqr(x[0,a]-x[1,i])+sqr(y[0,a]-y[1,i]);
if tmp>max then begin
max:=tmp;b:=i;
end;
end;
max:=0;
for i:=1 to n do begin
tmp:=sqr(x[0,i]-x[1,b])+sqr(y[0,i]-y[1,b]);
if tmp>max then begin
max:=tmp;a:=i;
end;
end;
until (a=a0)and(b=b0);
ans:=max;
end;
begin
assign(input,'faraway.in');reset(input);
assign(output,'faraway.out');rewrite(output);
randomize;
read(t);
for k:=1 to t do begin
read(n,m);ans:=0;ans0:=-1;
for i:=1 to n do read(x[0,i],y[0,i]);
for i:=1 to m do read(x[1,i],y[1,i]);
max:=-1;
for i:=1 to 50 do begin
ans:=0;ans0:=-1;
while ans<>ans0 do begin
if ans>ans0 then ans0:=ans;
suan;
end;
if ans>max then max:=ans;
end;
writeln(extended(sqrt(max)):0:3);
end;
close(input);close(output);
end.