Submission #1092592

#TimeUsernameProblemLanguageResultExecution timeMemory
1092592May27_thSenior Postmen (BOI14_postmen)C++17
0 / 100
6 ms12376 KiB
// #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt") #include<bits/stdc++.h> using namespace std; #define i64 long long #define mp make_pair #define pb push_back #define all(x) (x).begin(), (x).end() const int MAXN = 5e5 + 5; const int MAXK = 2; const i64 INF = LLONG_MAX/2; int N, M; vector<pair<int, int>> G[MAXN]; bool used[MAXN]; vector<int> path; void dfs(int u) { while (!G[u].empty()) { auto [v, id] = G[u].back(); G[u].pop_back(); if (used[id]) continue; used[id] = true; dfs(v); } path.pb(u); } void Solve(void) { cin >> N >> M; for (int i = 1; i <= M; i ++) { int u, v; cin >> u >> v; G[u].pb(mp(v, i)); G[v].pb(mp(u, i)); } dfs(1); for (auto x : path) cout << x << " "; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(10); int Tests = 1; // cin >> Tests; while (Tests --) { Solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...