比赛 NOIP2008集训模拟1 评测结果 ATWWTTTTTT
题目名称 血色叛徒 最终得分 10
用户昵称 NickName 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-10 09:07:39
显示代码纯文本
program crusade;
var x1,x2:longint;
ci,co:text;
time:longint;
n,m,a,b:longint;
person:array[1..500,1..2] of longint;
wenyi:array[1..500,1..2] of longint;
ls1,ls2:longint;
small:real;
procedure juli(a,b:longint);
var ls:real;
begin
ls:=sqr(person[a,1]-wenyi[b,1])+sqr(person[a,2]-wenyi[b,2]);
if sqrt(ls)<small then
begin
small:=sqrt(ls);
time:=abs(person[a,1]-wenyi[b,1]+person[a,2]-wenyi[b,2]);
end;
end;
begin
assign(ci,'crusade.in');
reset(ci);
assign(co,'crusade.out');
rewrite(co);
readln(ci,n,m,a,b);
fillchar(person,sizeof(person),false);
fillchar(wenyi,sizeof(wenyi),false);
for x1:=1 to a do
readln(ci,wenyi[x1,1],wenyi[x1,2]);
for x1:=1 to b do
readln(ci,person[x1,1],person[x1,2]);
close(ci);
for x1:=1 to b do
begin
small:=maxlongint;
for x2:=1 to a do
begin
juli(x1,x2);
end;
writeln(co,time);
end;
close(co);
end.