比赛 NOIP2008集训模拟1 评测结果 AWAAAAAWWA
题目名称 血色叛徒 最终得分 70
用户昵称 王瑞祥K 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-10 08:57:32
显示代码纯文本
program crusade(input,output);
type
 point=record
  x,y:integer;
end;
var
 sou,goal:array[1..250000]of point;
 ans:array[1..250000]of longint;
 m,n,a,b:longint;
procedure ini;
var i:integer;
begin
 assign(input,'crusade.in');assign(output,'crusade.out');
 reset(input);rewrite(output);
 readln(n,m,a,b);
 for i:=1 to a do readln(sou[i].x,sou[i].y);
 for i:=1 to b do readln(goal[i].x,goal[i].y);
 for i:=1 to b do ans[i]:=999999999;
end;
procedure main;
var i,j:integer;
begin
 for i:=1 to a do
  for j:=1 to b do
   if abs(sou[i].x-goal[j].x)+abs(sou[i].y-goal[j].y)<ans[j] then
   ans[j]:=abs(sou[i].x-goal[j].x)+abs(sou[i].y-goal[j].y);
 for i:=1 to b do writeln(ans[i]);
 close(input);close(output);
end;
begin
 ini;
 main;
end.