# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227314 | 2020-04-26T19:25:03 Z | Abdul_Mannan | Senior Postmen (BOI14_postmen) | C++14 | 19 ms | 23808 KB |
#include "bits/stdc++.h" using namespace std; const int maxn = 500005; multiset<int> edges[maxn]; vector<int> path; void dfs(int x){ while(!edges[x].empty()){ int i = *edges[x].begin(); edges[x].erase(edges[x].find(i)); edges[i].erase(edges[i].find(x)); dfs(i); } path.push_back(x); } int main(int argc, char const *argv[]) { // freopen("in.txt", "r", stdin); int n, m; scanf("%d %d", &n, &m); for(int i = 0; i < m; ++i){ int x, y; scanf("%d %d", &x, &y); edges[x].insert(y); edges[y].insert(x); } dfs(1); path.pop_back(); for(int i = 0; i < path.size(); i++) { printf("%d ",path[i]); } printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 23808 KB | Output is correct |
2 | Incorrect | 19 ms | 23808 KB | Same junction appears twice in a route |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 23808 KB | Output is correct |
2 | Incorrect | 19 ms | 23808 KB | Same junction appears twice in a route |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 23808 KB | Output is correct |
2 | Incorrect | 16 ms | 23808 KB | Same junction appears twice in a route |
3 | Halted | 0 ms | 0 KB | - |