记录编号 |
71497 |
评测结果 |
AAAAAAAA |
题目名称 |
双服务点设置 |
最终得分 |
100 |
用户昵称 |
钨铅 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.016 s |
提交时间 |
2013-10-08 23:59:44 |
内存使用 |
0.21 MiB |
显示代码纯文本
program floyd;
var a:array[0..100,0..100]of longint;
i,j,k,m,n,x,y,max,min,t:longint;
begin
assign(input,'djsb.in');
assign(output,'djsb.out');
reset(input);
rewrite(output);
read(n,m);
n:=n-1;
for i:=0 to n do
for j:=0 to n do if i<>j then a[i,j]:=maxlongint div 2 else a[i,j]:=0;
for i:=1 to m do begin
read(x,y,j);
a[x,y]:=j;
a[y,x]:=j;
end;
for k:=0 to n do
for i:=0 to n do
for j:=0 to n do if a[i,j]>a[i,k]+a[k,j] then a[i,j]:=a[i,k]+a[k,j];
max:=maxlongint;
for i:=0 to n-1 do
for j:=i+1 to n do begin
min:=0;
for k:=0 to n do begin
if a[i,k]>a[j,k] then t:=a[j,k] else t:=a[i,k];
if t>min then min:=t;
end;
if min<max then begin
max:=min;
x:=i;
y:=j;
end;
end;
write(x,' ',y);
close(input);
close(output);
end.