比赛 |
20101110 |
评测结果 |
AAAAAAAATT |
题目名称 |
奶牛派对 |
最终得分 |
80 |
用户昵称 |
ZhouZn1 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-10 21:44:15 |
显示代码纯文本
program zzn;
var
i,j,n,x,xx,yy,t,m,k,max:longint;
a:array[1..1000,1..1000]of longint;
procedure init;
begin
assign(input,'party.in');
reset(input);
assign(output,'party.out');
rewrite(output);
readln(n,m,x);
for i:=1 to n do
for j:=1 to n do if i=j then a[i,j]:=0 else
a[i,j]:=100000;
for i:=1 to m do
begin
readln(xx,yy,t);
a[xx,yy]:=t;
end;
end;
procedure closef;
begin
close(input);
close(output);
end;
procedure main;
begin
for k:=1 to n do
for i:=1 to n do
for j:=1 to n do
begin
if a[i,j]>a[i,k]+a[k,j] then
a[i,j]:=a[i,k]+a[k,j];
end;
max:=-1;
for i:=1 to n do if i<>x then
begin
if max<a[i,x]+a[x,i] then max:=a[i,x]+a[x,i];
end;
writeln(max);
end;
begin
init;
main;
closef;
end.