求教!最后两个点怎么也过不去。。

type bian=record a,b:longint; l:real; end;

var x,y,n,m:longint;

    i,j:longint;

    c:array[0..1000000] of bian;

    f:array[0..1000000] of longint;

    ans,s:real;

 procedure qsort(l,r:longint);

 var i,j:longint;

     y,t:bian;

 begin

   i:=l;j:=r;t:=c[(i+j) div 2];

   repeat

     while c[j].lt.l do inc(i);

     if ij;

 if j>l then qsort(l,j);

 if is then writeln('Impossible');

   writeln('Need ',ans:0:2,' miles of cable');

 end;

begin

  readln(s); readln(n); m:=0;

  while not eof do

  begin

    readln(c[m+1].a,c[m+1].b,c[m+1].l);

    inc(m);

  end;

  qsort(1,m);

  for i:=1 to m do f[i]:=i;

  i:=m;

  while (i>=1) and (j

1 条评论

  • 1

信息

ID
1045
难度
7
分类
树结构 点击显示
标签
(无)
递交数
4932
已通过
1000
通过率
20%
被复制
10
上传者