- YYB喋血
- 2012-11-10 18:34:47 @
var next,len,tail:array[-100000..100000] of longint;
first,d,q,p,r:array[1..20000] of longint;
u,v,e,i,j,m,n,cost,size,k,w:longint;
visit:array[1..20000] of boolean;
procedure swap(i,j:longint);
var tmp:longint;
begin
tmp:=q[i]; q[i]:=q[j]; q[j]:=tmp;
p[q[i]]:=i; p[q[j]]:=j;
end;
procedure up(k:longint);
begin
if (k>1) and (d[q[k]]d+len[e] then begin
d[v]:=d+len[e];
up(p[v]);
end;
e:=next[e];
end;
end;
end;
begin
readln(n,m,k);
for e:=1 to m do
begin
readln(u,v,w);
connect(u,v,e,w);
connect(v,u,-e,w);
end;
fillchar(visit,sizeof(visit),false);
DFS(1);
for i:=1 to k do
read(r[i]);
if not visit[n] then writeln('Oh no!')
else begin
dijkstra;
writeln(d[n]);
end;
end.