比赛 noip20081103 评测结果 AWWWWWWWWW
题目名称 放养奶牛 最终得分 10
用户昵称 EnAsn 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-03 21:46:42
显示代码纯文本
program ex;
type
 data=record
  x,y:integer;
 end;
 ss=array[1..100,1..40]of data;
 sz=array[1..100,1..100]of real;
 zs=array[1..100]of integer;
var
 c:zs;
 a:sz;
 f:ss;
 f1,f2:text;
 n:integer;
procedure init;
 var
  i,j,m:integer;
 begin
  assign(f1,'cowties.in');
  assign(f2,'cowties.out');
  reset(f1);
  rewrite(f2);
  readln(f1,n);
  for i:=1 to n do
   begin
    read(f1,m);
    c[i]:=m;
    for j:=1 to m do
     read(f1,f[i,j].x,f[i,j].y);
   end;
  for i:=1 to n do
   for j:=1 to n do
    a[i,j]:=maxint;
 end;
procedure main;
 var
  i,k,m:integer;
  t:real;
 begin
  for i:=1 to n do
   for m:=1 to c[i] do
     for k:=1 to c[i+1] do
      begin
       t:=sqrt(abs((f[i+1,k].y-f[i,m].y)*(f[i+1,k].y-f[i,m].y)+(f[i+1,k].x-f[i,m].x)*(f[i+1,k].x-f[i,m].x)));
       if t<a[i,i+1] then a[i,i+1]:=t;
      end;
 end;
procedure print;
 var
  i,j:integer;
  ans,t,max:real;
 begin
  for i:=1 to n-1  do
   ans:=ans+a[i,i+1];
  max:=maxint;
  for i:=1 to c[1]  do
   for j:=1 to c[n] do
     begin
       t:=sqrt(abs((f[1,i].y-f[n,j].y)*(f[1,i].y-f[n,j].y)+(f[1,i].x-f[n,j].x)*(f[1,i].x-f[n,j].x)));
      if t<max then max:=t;
     end;
  ans:=ans+max;
  writeln(f2,(ans*100):0:0);
 end;
begin
 init;
 main;
 print;
 close(f2);
end.