CF656E.Out of Controls

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:64MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a complete undirected graph. For each pair of vertices you are given the length of the edge that connects them. Find the shortest paths between each pair of vertices in the graph and return the length of the longest of them.

给你一个完全无向图。对于每一对顶点,你都被给定了连接它们的边的长度。请找出图中每对顶点之间的最短路径,并返回其中最长的那条路径的长度。

输入格式

The first line of the input contains a single integer N (3 ≤ N ≤ 10).

The following N lines each contain N space-separated integers. _j_th integer in _i_th line a__ij is the length of the edge that connects vertices i and j. a__ij = a__ji, a__ii = 0, 1 ≤ a__ij ≤ 100 for i ≠ j.

输入的第一行包含一个整数 NN(3≤N≤103 \leq N \leq 10)。

接下来的 NN 行,每行包含 NN 个以空格分隔的整数。第 ii 行中的第 jj 个整数 aija_{ij} 表示连接顶点 ii 和顶点 jj 的边的长度。满足 aij=ajia_{ij} = a_{ji},aii=0a_{ii} = 0,且当 i≠ji \neq j 时,1≤aij≤1001 \leq a_{ij} \leq 100。

输出格式

Output the maximum length of the shortest path between any pair of vertices in the graph.

输出图中任意一对顶点之间最短路径的最大长度。

输入输出样例

  • 输入#1

    3
    0 1 1
    1 0 4
    1 4 0

    输出#1

    2
  • 输入#2

    4
    0 1 2 3
    1 0 4 5
    2 4 0 6
    3 5 6 0

    输出#2

    5

说明/提示

You're running short of keywords, so you can't use some of them:

define
do
for
foreach
while
repeat
until
if
then
else
elif
elsif
elseif
case
switch

关键词不足,因此无法使用以下部分关键词:

define
do
for
foreach
while
repeat
until
if
then
else
elif
elsif
elseif
case
switch

输入解题思路,AI测评打分。不知道怎么写?

首页