比赛 20111107 评测结果 WWAWAAWWWA
题目名称 燃烧 最终得分 40
用户昵称 reamb 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-11-07 11:28:43
显示代码纯文本
program ranshao;
var
  bz,bz2:array[-200..200,-200..200]of boolean;
  k,t,i,j,l,p,n,v,v1,v2,x1,x2,y1,y2:longint;
  time,tt,llx,rrx,lly,rry,lx,ly,rx,ry,x,y:array[1..2000]of real;
  ans,xxx,d:real;
  a:array[1..2000]of longint;
  map:array[1..1000,1..1000]of real;
function find(xx,yy:real):longint;
var
  i:longint;
begin
  for i:=1 to t do
    if (x[i]=xx)and(y[i]=yy) then
      exit(i)
end;
function min1(a,b:longint):longint;
begin
  if a<b then
    exit(a)
  else
    exit(b)
end;
function min(a,b:real):real;
begin
  if a<b then
    exit(a)
  else
    exit(b)
end;
function max(a,b:real):real;
begin
  if a>b then
    exit(a)
  else
    exit(b)
end;
begin
  assign (input,'firez.in');
  reset (input);
  assign (output,'firez.out');
  rewrite (output);
    readln (n);
    for i:=-200 to 200 do
      for j:=-200 to 200 do
      begin
        bz[i,j]:=true;
        bz2[i,j]:=true;
      end;
    for i:=1 to n do
    begin
      readln (x1,y1,x2,y2,time[i]);
      lx[i]:=x1;
      ly[i]:=y1;
      rx[i]:=x2;
      ry[i]:=y2;
      if bz[x1,y1] then
      begin
        inc(t);
        x[t]:=x1;
        y[t]:=y1;
        bz[x1,y1]:=false;
        inc(p);
        a[p]:=t
      end;
      if bz[x2,y2] then
      begin
        inc(t);
        x[t]:=x2;
        y[t]:=y2;
        bz[x2,y2]:=false;
        inc(p);
        a[p]:=t
      end;
      if (x1<>x2)and(y1<>y2)and(bz2[min1(x1,x2),min1(y1,y2)]) then
      begin
        inc(t);
        x[t]:=(x1+x2)/2;
        y[t]:=(y1+y2)/2;
        bz2[min1(x1,x2),min1(y1,y2)]:=false;
        inc(l);
        tt[l]:=time[i]/2;
        llx[l]:=x1;
        lly[l]:=y1;
        rrx[l]:=x[t];
        rry[l]:=y[t];
        inc(l);
        tt[l]:=time[i]/2;
        llx[l]:=x[t];
        lly[l]:=y[t];
        rrx[l]:=x2;
        rry[l]:=y2;
      end
      else
      begin
        inc(l);
        tt[l]:=time[i];
        llx[l]:=x1;
        lly[l]:=y1;
        rrx[l]:=x2;
        rry[l]:=y2
      end
    end;
    for i:=1 to t do
      for j:=1 to t do
        if i=j then
          map[i,j]:=0
        else
          map[i,j]:=maxlongint;
    for i:=1 to l do
    begin
      v1:=find(llx[i],lly[i]);
      v2:=find(rrx[i],rry[i]);
      map[v1,v2]:=tt[i];
      map[v2,v1]:=tt[i]
    end;
    for k:=1 to t do
      for i:=1 to t do
        for j:=1 to t do
          if (map[i,k]<>maxlongint)and(map[k,j]<>maxlongint) then
            if map[i,k]+map[k,j]<map[i,j] then
              map[i,j]:=map[i,k]+map[k,j];
    xxx:=maxlongint;
    for i:=1 to p do
    begin
      v:=a[i];
      ans:=0;
      for j:=1 to l do
      begin
        v1:=find(llx[j],lly[j]);
        v2:=find(rrx[j],rry[j]);
        d:=max(map[v,v1],map[v,v2])-min(map[v,v1],map[v,v2]);
        if d>=tt[j] then
        begin
          if max(map[v,v1],map[v,v2])>ans then
            ans:=max(map[v,v1],map[v,v2])
          else
          begin
            if d+(tt[j]-d)/2>ans then
              ans:=d+(tt[j]-d)/2
          end
        end
      end;
      if ans<xxx then
       xxx:=ans
    end;
    writeln (xxx:0:4);
  close (input);
  close (output)
end.