比赛 |
20091103 |
评测结果 |
AAAAAAAAAA |
题目名称 |
热浪 |
最终得分 |
100 |
用户昵称 |
Achilles |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2009-11-03 10:36:34 |
显示代码纯文本
program heatwvx;
var
t,c,ts,te,a,b,c1,i,j:longint;
tab:array[1..2500,1..2500]of longint;
procedure dijkstra;
var
flag:array[1..2500]of boolean;
w,x,i,j,min,minn:longint;
begin
fillchar(flag,sizeof(flag),false);
flag[ts]:=true;
minn:=ts;
for x:=2 to t do
begin
min:=2147483647;
for i:=1 to t do
if (tab[ts,i]<min)and(flag[i]=false) then
begin
min:=tab[ts,i];
minn:=i;
end;
flag[minn]:=true;
for j:=1 to t do
if (j<>minn) and (tab[ts,minn]+tab[minn,j]<tab[ts,j]) and(flag[j]=false) then
tab[ts,j]:=tab[ts,minn]+tab[minn,j];
end;
write(tab[ts,te],' ');
end;
begin
assign(input,'heatwvx.in');
assign(output,'heatwvx.out');
reset(input);
rewrite(output);
readln(t,c,ts,te);
for i:=1 to t do
for j:=1 to t do
tab[i,j]:=2000000000;
for i:=1 to c do
begin
readln(a,b,c1);
tab[a,b]:=c1;
tab[b,a]:=c1;
end;
dijkstra;
close(input);
close(output);
end.