讨论 / why 挂了??
zhang999 2012-07-25 03:14:00
点我顶贴 收藏 删除

状态: 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为何会错??

#1 xiaowukong@2010-11-16 18:41:00
回复 删除
和我挂的一样,纠结中。。。
#2 897357142@2012-07-25 03:14:00
回复 删除
都是同道中人……2年了,不知道你们过没。
#3 圈圈烤企鹅@2014-10-19 01:54:59
回复 删除
回复 #2 897357142:
#4 圈圈烤企鹅@2014-10-19 01:55:23
回复 删除
又是两年了。。不知道你们过没。。
#5 王嘉靖@2014-10-20 03:49:33
回复 删除
回复 #4 圈圈烤企鹅:我过了
查看更多回复
提交回复