讨论 / 大牛帮忙398 wa:60
&Ogravezyf2010 2010-07-17 17:57:00
点我顶贴 收藏 删除
状态: Unaccepted

测评机: Xeond[6]

得分: 60分

提交日期: 2010-7-18 8:50:00

有效耗时: 375毫秒

测试结果1: 通过本测试点|有效耗时172ms

测试结果2: 通过本测试点|有效耗时47ms

测试结果3: 通过本测试点|有效耗时156ms

测试结果4: 测试结果错误.错误结果为:5362

escape

正确结果应为:4486

escape

测试结果5: 运行错误|未定义错误编号|错误编号:106

type

fff=array[1..200000] of record

b,next,l:longint;

end;

var

t,r1,f1,tot,n,m,sum,i,j,x,y,a,b,s:longint;

d,last:array[0..100000] of longint;

f:fff;

p:array[1..300000] of longint;

ff:array[1..100000] of boolean;

begin

readln(n,m,t);

fillchar(last,sizeof(last),0);

for i:=1 to m do

begin

readln(a,b,s);

tot:=tot+1;

f[tot].b:=b;

f[tot].next:=last[a];

f[tot].l:=s;

last[a]:=tot;

tot:=tot+1;

f[tot].b:=a;

f[tot].next:=last[b];

f[tot].l:=s;

last[b]:=tot;

end;

for i:=1 to n do

d[i]:=maxlongint div 2;

fillchar(ff,sizeof(ff),false);

d[1]:=0;

r1:=0;f1:=1;p[f1]:=1;

ff[1]:=true;

while r1<f1 do

begin

r1:=r1+1;

x:=last[p[r1]];

while x<>0 do

begin

y:=f[x].b;

if d[p[r1]]+f[x].l<d[y] then

begin

d[y]:=d[p[r1]]+f[x].l;

if not ff[y] then

begin

ff[y]:=true;

f1:=f1+1;

p[f1]:=y;

end;

end;

x:=f[x].next;

end;

ff[p[r1]]:=true;

end;

sum:=0;

for i:=1 to n do

sum:=sum+d[i];

sum:=sum*2;

writeln(sum);

if sum<=t then writeln('run')

else writeln('escape');

end.

查看更多回复
提交回复