PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#FW0000004. Hệ thống truyền tin MPI (MPI Maelstrom)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Hệ thống truyền tin MPI (MPI Maelstrom)
MPI Maelstrom
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
An undirected network of processors is described by a lower-triangular matrix of direct transmission delays; x denotes no connection. Find the largest shortest-path delay from processor .
Input
, followed by row () containing weights or x.
Output
Print the largest shortest distance from processor .
Subtasks
- Subtask 1 (40 points): ; ; .
- Subtask 2 (60 points): ; .
Examples
Input
3
3
x 4
Output
7
Explanation
Processor reaches processor in time units, then processor in ; there is no direct edge .