比赛 |
20101110 |
评测结果 |
AWWWWWWWTT |
题目名称 |
奶牛派对 |
最终得分 |
10 |
用户昵称 |
make |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-10 19:19:03 |
显示代码纯文本
program party;
var
h:array [1..1000,1..1000] of longint;
n,m,x,max:longint;
f1,f2:text;
procedure init;
var i,j,k,u:longint;
begin
assign(f1,'party.in'); reset(f1);
assign(f2,'party.out'); rewrite(f2);
readln(f1,n,m,x);
for i:=1 to n do
for j:=1 to n do
h[i,j]:=maxlongint;
for u:=1 to n do begin
read(f1,i,j,k);
h[i,j]:=k;
end;
close(f1);
max:=-1;
end;
procedure play;
var
i,j,k:longint;
begin
for k:=1 to n do
for i:=1 to n do
for j:=1 to n do
if (h[i,k]<>maxlongint)and(h[k,j]<>maxlongint) then
if (h[i,k]+h[k,j]<h[i,j]) then
h[i,j]:=h[i,k]+h[k,j];
end;
procedure search;
var i,j:longint;
begin
for i:=1 to n do
if (h[i,x]<>maxlongint)and(h[x,i]<>maxlongint) then
if h[i,x]+h[x,i]>max then max:=h[i,x]+h[x,i];
writeln(f2,max);
close(f2);
end;
begin
init;
play;
search;
end.