比赛 20101118 评测结果 AAAAAAAAAA
题目名称 扩散 最终得分 100
用户昵称 ZhouZn1 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-18 09:55:27
显示代码纯文本
program zzn;
var
        n,i,j,ans,k:longint;
        a:array[1..2,1..50]of longint;
        map:array[1..50,1..50]of longint;
procedure init;
begin
        assign(input,'ppg.in');
        reset(input);
        assign(output,'ppg.out');
        rewrite(output);
        readln(n);
        for i:=1 to n do readln(a[1,i],a[2,i]);
end;
procedure closef;
begin
        close(input);
        close(output);
end;
function dist(x1,y1,x2,y2:longint):longint;
begin
    dist:=(abs(x1-x2)+abs(y1-y2))shr 1 +((abs(x1-x2)+abs(y1-y2))mod 2);
end;
function max(a,b:longint):longint;
begin
    if a<b then exit(b) else exit(a);
end;
procedure main;
begin
        fillchar(map,sizeof(map),255);
        for i:=1 to n do
        for j:=1 to n do
         begin
             if i=j then map[i,j]:=0 else
             map[i,j]:=dist(a[1,i],a[2,i],a[1,j],a[2,j]);
         end;
        for k:=1 to  n do
         for i:=1 to n do if i<>k then
          for j:=1 to n do if i<>j then
           if (map[i,k]<>-1)and(map[k,j]<>-1) then
            begin
               if (map[i,j]=-1)or(map[i,j]>max(map[i,k],map[k,j])) then
                map[i,j]:=max(map[i,k],map[k,j]);
            end;
        ans:=0;
        for i:=1 to n do
         for j:=1 to n do if i<>j then
          if ans<map[i,j] then ans:=map[i,j];
        writeln(ans);
end;
begin
        init;
        main;
        closef;
end.