最短路径
Description
Given a directed graph G=(V, E), and a source vertex v0, please write a program to output the lengths of the shortest paths between v0 and all other vertices in the graph G. We assume the edges in digraph G can have negative costs, provided that the sum of the costs around any cycle in the digraph is positiv. The vertices are labeled from 1 to n, if G has n vertices. The data fromats of the input and the output of this problem are arranged as follows.
Input
Your program must accept the following input data: