比赛 2008haoi模拟训练2 评测结果 WWWTT
题目名称 公路建设 最终得分 0
用户昵称 zxc111 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-04-23 10:48:22
显示代码纯文本
program ooo;
var
t:text;
a:array[1..2000,1..2] of LONGINT;
b:array[1..2000] of real;
m,n,j,k,l,i,min1,o,p:longint;

min,x,y:real;
qq:array[1..5000] of real;
c:array[1..500] of boolean;
procedure oo(yy:longint);
var
i,w:longint;
begin
fillchar(c,sizeof(c),false);
fillchar(qq,sizeof(qq),0);
min1:=0;
for i:=1 to n do
 begin
 w:=0;

 if c[i]=false then begin
 min:=maxlongint;
 for j:=1 to yy do
  if (a[j,1]=i)and(b[j]<min) then begin o:=j;min:=b[j];p:=1;end;
 for k:=1 to yy do
  if (a[k,2]=i)and(b[k]<min) then begin o:=k;min:=b[k];p:=2;end;
  inc(min1);
  qq[min1]:=min;
  c[a[o,1]]:=true;
  c[a[o,2]]:=true;
  end else;end;
  w:=0;x:=0;
  for j:=1 to n do
  if c[j]=false then w:=1;
  if w=0 then begin
  for i:=1 to min1 do
  x:=x+qq[i];
  writeln(t,(x/2):0:1) end else writeln(t,0);
 end;

begin
assign(t,'road.in');
reset(t);
readln(t,n,m);
for i:=1 to m do
readln(t,a[i,1],a[i,2],b[i]);
close(t);
assign(t,'road.out');
rewrite(t);
for i:=1 to m do
oo(i);
close(t);
end.