70pts,WA on #6#9#10
我下了 #6 的数据,代码莫名 RE
然后发现 #6 的数据跑一次 DFS 都会 RE???
跑 DFS 的代码:
#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<int> e[100005];
bool vis[100005] = {};
void dfs(long long x) {
vis[x] = true;
for (auto i: e[x])
if (!vis[i])
dfs(i);
}
int main() {
freopen("P3469_6.in", "r", stdin);
cin >> n >> m;
for (int i = 1, u, v; i <= m; i++) {
cin >> u >> v;
e[u].push_back(v);
e[v].push_back(u);
}
dfs(1);
return 0;
}