记录编号 32557 评测结果 WAAAWAWAWA
题目名称 燃烧 最终得分 60
用户昵称 Gravatarlizhe 是否通过 未通过
代码语言 Pascal 运行时间 0.011 s
提交时间 2011-11-07 11:56:02 内存使用 2.87 MiB
显示代码纯文本
program firez;
const
  maxtin=10000000;
var
  i,j,l,n,x0,y0,x1,x2,y1,y2,t,num,minn:longint;
  flag:array[1..200]of boolean;
  rudu:array[1..200]of longint;
  a:array[-400..400,-400..400]of longint;
  map:array[1..200,1..200]of real;
  d:array[1..200]of real;
  max,min,mi:real;
procedure init;
begin
  assign(input,'firez.in');
  reset(input);
  assign(output,'firez.out');
  rewrite(output);
  read(n);
  for i:=1 to 3*n do
    for j:=1 to 3*n do
      map[i,j]:=maxtin;
  for i:=1 to n do
  begin
    read(x1,y1,x2,y2,t);
    x1:=x1*2; y1:=y1*2; x2:=x2*2; y2:=y2*2;
    x0:=(x1+x2) div 2;
    y0:=(y1+y2) div 2;
    if a[x1,y1]=0 then
    begin
      inc(num);
      a[x1,y1]:=num
    end;
    if a[x2,y2]=0 then
    begin
      inc(num);
      a[x2,y2]:=num
    end;
    if a[x0,y0]=0 then
    begin
      inc(num);
      a[x0,y0]:=num
    end;
    map[a[x1,y1],a[x2,y2]]:=t;
    map[a[x1,y1],a[x0,y0]]:=t/2;
    map[a[x2,y2],a[x0,y0]]:=t/2;
    map[a[x2,y2],a[x1,y1]]:=t;
    map[a[x0,y0],a[x1,y1]]:=t/2;
    map[a[x0,y0],a[x2,y2]]:=t/2;
    rudu[a[x0,y0]]:=1;
  end
end;

procedure dijkstra;
begin
  fillchar(flag,sizeof(flag),true);
  fillchar(d,sizeof(d),0);
  for i:=1 to num do
    d[i]:=map[l,i];
  flag[l]:=false;
  for i:=1 to num-1 do
  begin
    mi:=maxtin;
    for j:=1 to num do
      if (mi>d[j]) and flag[j] then
      begin
        mi:=d[j];
        minn:=j
      end;
    flag[minn]:=false;
    for j:=1 to num do
      if d[j]>d[minn]+map[minn,j] then
        d[j]:=d[minn]+map[minn,j]
  end;
  max:=0;
  for i:=1 to num do
    if (max<d[i]) and (d[i]<maxtin) then
      max:=d[i]
end;

procedure main;
begin
  min:=maxtin;
  for l:=1 to num do
    if rudu[l]=0 then
    begin
      dijkstra;
      if min>max then
        min:=max
    end
end;

procedure print;
begin
  writeln(min:0:4);
  close(input);
  close(output)
end;

begin
  init;
  main;
  print
end.