比赛 NOIP2008集训模拟1 评测结果 AWTTTTTWWT
题目名称 血色叛徒 最终得分 10
用户昵称 Hamster 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-10 09:14:21
显示代码纯文本
program crusade;
var
  a1,b1:array[1..500] of integer;
  a2,b2:array[1..500] of integer;
  h:array[1..500] of integer;
  x,y,m,ss,s,n,i,j:integer;

  fin,fout:text;

begin
  assign(fin,'crusade.in');
  assign(fout,'crusade.out');
  reset(fin);
  rewrite(fout);

  read(fin,x,y,m,n);
  for i:=1 to m do read(fin,a1[i],b1[i]);
  for i:=1 to n do read(fin,a2[i],b2[i]);
  for i:=1 to n do
  begin
    ss:=2000;
    for j:=1 to m do
    begin
      if (abs(a1[j]-a2[i])+abs(b1[j]-b2[i]))<ss then 
      ss:=abs(a1[j]-a2[i])+abs(b1[j]-b2[i]);
    end;
    h[i]:=ss;
  end;
  for i:=1 to n do writeln(fout,h[i]);

  close(fin);
  close(fout);
end.