Floyd - 1
A complete directed weighted graph is given by its adjacency matrix. Construct a matrix of the shortest paths between all pairs of its vertices. It is guaranteed that the graph has no cycles of negative weight.
Input
The first line contains the number of vertices in the graph. Each of the next lines contains integers and describes the adjacency matrix of the graph (the -th number in the -th row corresponds to the weight of the edge from vertex to vertex ). All numbers by the absolute value do not exceed . The diagonal elements of the matrix are always zeros.
Output
Print lines with integers — the matrix of the shortest distances between all pairs of vertices. The -th number in the -th row should equal the weight of the shortest path from vertex to vertex .