Why I got WA??? Help !!!
Posted by
XueMao 21 Jul 2002 20:40
{$n+}
Program UnderGround;
Const max=202;
max1=30000;
Var i,j,k,m,n,r,t,k1,k2:longint;
value:double;
v1,v2,L:double;
a:array[1..max,1..2] of double;
c:array[1..max,1..max] of double;
g:array[1..max] of integer;
b,Link,f:array[1..max1] of byte;
Long1:array[1..max1] of double;
d:array[1..max] of double;
Function Long(x,y,x1,y1:double):double;
begin
Long:=sqrt(sqr(x1-x)+sqr(y1-y));
end;
Begin
fillchar(a,sizeof(a),0);
fillchar(c,sizeof(c),0);
read(v1,v2);
read(n);
for i:=1 to n do
read(a[i,1],a[i,2]);
fillchar(g,sizeof(g),0);
repeat
read(k1,k2);
if k1<>0 then
begin
c[k1,k2]:=Long(a[k1,1],a[k1,2],a[k2,1],a[k2,2])/v2;
c[k2,k1]:=c[k1,k2];
end;
until (k1=0)or(k2=0);
read(a[n+1,1],a[n+1,2],a[n+2,1],a[n+2,2]);
inc(n,2);
for i:=1 to n-1 do
for j:=i+1 to n do
if c[i,j]=0 then
begin
c[i,j]:=Long(a[i,1],a[i,2],a[j,1],a[j,2])/v1;
c[j,i]:=c[i,j];
end;
fillchar(link,sizeof(link),0);
fillchar(long1,sizeof(long1),0);
r:=0;
t:=1;
for i:=1 to n do d[i]:=-1;
d[n-1]:=0;
fillchar(b,sizeof(b),0);
b[1]:=n-1;
while r<t do
begin
inc(r);
for j:=1 to n do
begin
Value:=Long1[r]+c[b[r],j];
if (d[j]=-1)or(Value<d[j])
then
begin
d[j]:=Value;
inc(t);
b[t]:=j;
Link[t]:=r;
Long1[t]:=Value;
if b[t]=n then m:=t;
end;
end;
end;
writeln(d[n]:0:7);
fillchar(f,sizeof(f),0);
t:=m;
k:=0;
while t<>0 do
begin
inc(k);
f[k]:=t;
t:=Link[t];
end;
write(k-2,' ');
for i:=k-1 downto 2 do write(b[f[i]],' ');
End.