#include the "iostream" #include "memory.h" #include "Cstdio" using namespace Std;int grap[500][500];int ans;int dis[500]; BOOL Visited[500];void Prime (int n) {int source = 1;for (int i = 1; I <= n; i++) {dis[i] = grap[source][i];visited[i] = f Alse;} Visited[source] = true;for (int j = 1; j < N; j + +) {int min =65535;int index = 0;for (int i = 1; I <= n; i++) {if (!vi Sited[i] && Dis[i] < min) {min = Dis[i];index = i;}} Visited[index] = true;if (ans < min) ans = min;for (int i = 1; I <= n; i++) {if (!visited[i] && (Grap[index][i] ) < Dis[i]) {dis[i] = Grap[index][i];}}} int main () {int N;bool ok = false;int t;cin >> t;while (t--) {if (OK) cout << Endl;ok = true;cin >> n;if ( N < 3) {cout << "\ n"; continue;} ans = -1000;for (int i = 1; I <= n; i++) {for (int j = 1; J <= N; j + +) {cin >> grap[i][j];grap[j][i] = grap[i][j ];}} Prime (n); cout << ans << Endl;}}
1090. Highways