比赛 |
NOIP2008集训模拟1 |
评测结果 |
AWAAAAAWWA |
题目名称 |
血色叛徒 |
最终得分 |
70 |
用户昵称 |
chengyang |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-11-10 08:55:28 |
显示代码纯文本
program crusade;
var
a:array[1..25000,1..2]of longint;
b:array[1..25000,1..3]of longint;
m,n,c,d:integer;
procedure go(i:longint);
var
j:longint;
Begin
for j:=1 to c do begin
if (abs(a[j,1]-b[i,1])+abs(a[j,2]-b[i,2]))<b[i,3] then b[i,3]:=abs(a[j,1]-b[i,1])+abs(a[j,2]-b[i,2]);
end;
End;
procedure ini;
var
i:longint;
Begin
assign(input,'crusade.in');
assign(output,'crusade.out');
reset(input); rewrite(output);
readln(n,m,c,d);
for i:=1 to c do readln(a[i,1],a[i,2]);
for i:=1 to d do begin
readln(b[i,1],b[i,2]);
b[i,3]:=maxint;
go(i);
end;
End;
procedure ot;
var
i:longint;
Begin
for i:=1 to d do writeln(b[i,3]);
close(input); close(output);
End;
Begin
ini;
ot;
End.