版本比较
GESP7级 202512 -1
正文
增加 13 行删除 13 行
22 行未改动232425262727282930303132333413 行未改动484950515253525354555657585960606162636364656667686768697070717273747374757677787879808182838484858687886 行未改动22 行未改动#include<bits/stdc++.h>using namespace std;const int N = 2005;int n, m, dis[N], vis[N], ans, maxs;vector<int> a[N]; vector<int> a[N];queue<int> q;
//SPFA大人 //SPFA大人void spfa(int k) { q.push(k); while (!q.empty()) { int x = q.front();13 行未改动}
int main() { cin >> n >> m; //存边
//存边 for (int i = 1; i <= m; i++) { int x, y; cin >> x >> y; a[x].push_back(y); a[y].push_back(x); }
maxs = INT_MAX; for (int i = 1; i <= n; i++) { //别忘了初始化 //别忘了初始化 while (!q.empty()) q.pop(); for (int j = 1; j <= n; j++) { vis[j] = 0; dis[j] = 1e9;//每个点刚开始到其他点是无穷大的 if (i == j) dis[j] = 0; dis[j] = 1e9;//每个点刚开始到其他点是无穷大的 if (i == j) dis[j] = 0; }
//SPFA spfa(i); //比较
//比较 int g = -1; for (int j = 1; j <= n; j++) { g = max(g, dis[j]); } } if (g < maxs) { maxs = g; ans = i; } }
cout << ans; return 0;}```6 行未改动