比赛 20101118 评测结果 WWWWWWWWWW
题目名称 扩散 最终得分 0
用户昵称 nick09 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-18 09:49:12
显示代码纯文本
var   n,i,j,k,s:longint;
   x,y:array[0..51]of longint;
   tot:int64;
   g:array[0..51]of boolean;
   t:array[0..51,0..51]of boolean;
   f:array[0..51,0..51]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]);
fillchar(g,sizeof(g),false);
fillchar(t,sizeof(t),false);
if n=1 then begin writeln('0');close(input);close(output);halt;   end;

for i:=1 to n-1 do
  for j:=i+1 to n do
   begin
   if x[i]>x[j] then begin
     k:=x[i];x[i]:=x[j];x[j]:=k;
     k:=y[i];y[i]:=y[j];y[j]:=k;
     end;
   end;

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
     begin
     if i=j then f[i,j]:=0;
     if i<>j then
     begin
     s:=abs(x[i]-x[j])+abs(y[i]-y[j]);
     if s mod 2 =1 then inc(s);
     f[i,j]:=s div 2;
     end;
     end;
tot:=0;
if n=2 then begin writeln(f[1,2]);close(input);close(output);  end;
if n>2 then begin
 for k:=1 to n do
   for i:=1 to n do
      for j:=1 to n do
   if (k<>i )and(k<>j)and(i<>j) then
    begin
     if (f[i,j]>f[k,j])and(f[i,k]<=f[k,j]) then
       f[i,j]:=f[k,j];

   end;
 tot:=0;
 for i:=1 to n do
     if (f[1,i]>tot)and(f[1,i]<>0) then tot:=f[1,i];
 writeln(tot);
 close(input);close(output);
 end;
end.