Submission #1262407

#TimeUsernameProblemLanguageResultExecution timeMemory
1262407EntityPlanttSenior Postmen (BOI14_postmen)C11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

constexpr int N = 5e5;
vector<int> g[N];
int vis[N];
set<int> path;

int dfs(int u) {
	path.insert(u);
	while (!g[u].empty()) {
		int v = g[u].back();
		g[v].erase(find(g[v].begin(), g[v].end(), u));
		g[u].pop_back();
		if (path.count(v)) {
			path.erase(u);
			cout << u + 1 << ' ';
			return v;
		}
		int r = dfs(v);
		if (r != u) {
			path.erase(u);
			cout << u + 1 << ' ';
			return r;
		}
		else cout << u + 1 << '\n';
	}
	return -1;
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	while (m--) {
		int a, b;
		cin >> a >> b;
		g[--a].push_back(--b);
		g[b].push_back(a);
	}
	dfs(0);
}

Compilation message (stderr)

postmen.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.