比赛 |
NOIP2008集训模拟1 |
评测结果 |
ATWWWWWTTW |
题目名称 |
血色叛徒 |
最终得分 |
10 |
用户昵称 |
zpl123 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-11-10 09:38:04 |
显示代码纯文本
program crusade;
const
max=500;
type
type1=array[1..max,1..max]of boolean;
type2=record
x,y:longint;
end;
var
d:type1; l,w:array[1..max]of type2;
t:array[1..max*max]of longint;
m,n,a,b,k1,k2:longint;
procedure init;
var
i,x,y:longint;
begin
assign(input,'crusade.in');
reset(input);
assign(output,'crusade.out');
rewrite(output);
fillchar(d,sizeof(d),true);
fillchar(t,sizeof(t),0);
readln(n,m,a,b);
for i:=1 to a do
begin
readln(w[i].x,w[i].y);
inc(k1);
end;
for i:=1 to b do
begin
readln(l[i].x,l[i].y);
inc(k2);
end;
close(input);
end;
procedure main;
var
p,i,j:longint;
begin
p:=0;
for i:=1 to k2 do
begin
p:=abs(w[1].x-l[i].x)+abs(w[1].y-l[i].y);
for j:=2 to k1 do
if abs(w[j].x-l[i].x)+abs(w[j].y-l[i].y)<=p then
p:=abs(w[j].x-l[i].x)+abs(w[j].y-l[i].y);
t[i]:=p;
end;
end;
procedure print;
var
i:longint;
begin
for i:=1 to b do
writeln(t[i]);
close(output);
end;
begin
init;
main;
print;
end.