状态: Unaccepted
测评机: Xeond[6]
得分: 60分
提交日期: 2010-11-10 18:58:00
有效耗时: 609毫秒
测试结果1: 通过本测试点|有效耗时156ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时47ms
测试结果5: 测试结果错误.错误结果为:51.96
正确结果应为:44.47
测试结果6: 测试结果错误.错误结果为:24.45
正确结果应为:21.83
测试结果7: 测试结果错误.错误结果为:76.50
正确结果应为:59.98
测试结果8: 测试结果错误.错误结果为:152.02
正确结果应为:138.59
测试结果9: 通过本测试点|有效耗时156ms
测试结果10: 通过本测试点|有效耗时156ms
提交代码: var
n,i,m,j,k,v,head,tail:longint;
a:array [1..1000,1..3] of longint;
lowcost:array [1..1000] of extended;
b:array [1..10000] of boolean;
f:array [1..100000] of longint;
w1,w2:extended;
begin
readln(n,v);
for i:=1 to n do
lowcost[i]:=100000000;
for i:=1 to n do
begin
for j:=1 to 3 do
read(a[i,j]);
readln;
end;
lowcost[1]:=0;
head:=1; tail:=1; f[1]:=1;
while head<=tail do
begin
k:=f[head];
b[k]:=false;
for i:=1 to n do if i<>k then
begin
w1:=100000000;
if (a[k,1]=a[i,1]) and (a[k,2]>a[i,2]) then w1:=sqrt((a[k,2]-a[i,2])*2/10);
if a[i,3]=k then
if sqrt(sqr(a[k,1]-a[i,1])+sqr(a[k,2]-a[i,2]))/v<w1 then
w1:=sqrt(sqr(a[k,1]-a[i,1])+sqr(a[k,2]-a[i,2]))/v;
if w1+lowcost[k]<lowcost[i] then
begin
lowcost[i]:=w1+lowcost[k];
if b[i]=false then
begin
inc(tail);
f[tail]:=i;
b[i]:=true;
end;
end;
end;
inc(head);
end;
writeln(lowcost[n]:2:2);
end.
求各位大牛帮忙啊!SPFA为何会错??