12 2 s 128 MB
The first line contains the number of test cases T (T ≤ 150).
For each data set, a single line of output should appear. For each case, the first line contains the number of farms, N (3 <= N <= 100). The following lines contain the N x N conectivity matrix, where each element shows the distance from on farm to another. Logically, they are N lines of N space-separated integers. Physically, they are limited in length to 80 characters, so some lines continue onto others. Of course, the diagonal will be 0, since the distance from farm i to itself is not interesting for this problem.
For each case, output a single integer length that is the sum of the minimum length of fiber required to connect the entire set of farms.
1 4 0 4 9 21 4 0 8 17 9 8 0 16 21 17 16 0