正文
增加 13 行删除 13 行
22 行未改动23242526272829303132333413 行未改动48495051525354555657585960616263646566676869707172737475767778798081828384858687886 行未改动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];queue<int> q;//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;}//SPFAspfa(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 行未改动22 行未改动23242526272829303132333413 行未改动48495051525354555657585960616263646566676869707172737475767778798081828384858687886 行未改动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];queue<int> q;//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;}//SPFAspfa(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 行未改动