比赛 20101118 评测结果 WWWWWWWWWW
题目名称 扩散 最终得分 0
用户昵称 reamb 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-18 11:09:38
显示代码纯文本
program kuosan;
var
  n,i,j,k,max:longint;
  x,y:array[1..50]of longint;
  f:array[1..50,1..50]of longint;
begin
  assign (input,'ppg.in');
  reset (input);
  assign (output,'ppg.out');
  rewrite (output);
    readln (n);
    for i:=1 to n do
      readln (x[i],y[i]);
    for i:=1 to n do
      for j:=1 to n do
        f[i,j]:=maxlongint;
    for i:=1 to n do
      for j:=1 to n do
        if i=j then
          f[i,j]:=0
        else
          f[i,j]:=(abs(x[i]-x[j])+abs(y[i]-y[j])-1)div 2+1;
    for k:=1 to n do
      for i:=1 to n do
        for j:=1 to n do
          if (f[i,k]<>maxlongint)and(f[k,j]<>maxlongint)then
          if f[i,k]+f[k,j]<f[i,j] then
            f[i,j]:=f[i,k]+f[k,j];
    max:=0;
    for i:=1 to n do
      for j:=1 to n do
        if (f[i,j]<>maxlongint)and(f[i,j]>max) then
          max:=f[i,j];
    writeln (max);
  close (input);
  close (output)
end.