Pro.ID1538 TitleHighways Title链接http://10.20.2.8/oj/exercise/problem?problem_id=1538 AC16 Submit83 Ratio19.28% 时间&空间限制描述The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. They're planning to build some highways so that it will be possible to drive between any pair of towns without leaving the highway system. 输入The First line of input is an integer T, indicating the number of tase cases. The first line is an integer N ( 3 ≤ N ≤ 500 ), which is the number of villages. Then come N lines, the i-th of which contains N integers, and the j-th of these N integers is the distance (the distance should be an integer within [1, 65536]) between village i and village j. 输出Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. They're planning to build some highways so that it will be possible to drive between any pair of towns without leaving the highway system. Input The First line of input is an integer T, indicating the number of tase cases. The first line is an integer N ( 3 ≤ N ≤ 500 ), which is the number of villages. Then come N lines, the i-th of which contains N integers, and the j-th of these N integers is the distance (the distance should be an integer within [1, 65536]) between village i and village j. Output You should output a line contains an integer, which is the length of the longest road to be built such that all the villages are connected, and this value is minimum. Sample Input 1 Sample Output 692 Source 样例输入1 样例输出692 提示作者 |