# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44721 | 2018-04-05T12:32:52 Z | Pajaraja | Senior Postmen (BOI14_postmen) | C++17 | 22 ms | 23808 KB |
#include <bits/stdc++.h> using namespace std; set<int> g[500007]; stack<int> st,sk; bool vi[500007]; void euler(int s) { while(!g[s].empty()) { int t=*g[s].begin(); g[s].erase(t); g[t].erase(s); euler(t); } st.push(s); } int main() { int n,m; scanf("%d%d",&n,&m); for(int i=0;i<m;i++) { int t1,t2; scanf("%d%d",&t1,&t2); g[t1].insert(t2); g[t2].insert(t1); } euler(1); for(int i=0;i<m+1;i++) { int x=st.top(); st.pop(); sk.push(x); if(vi[x]) { while(sk.top()!=x) { int y=sk.top(); printf("%d ",y); sk.pop(); vi[y]=false; } printf("\n"); } vi[x]=true; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 23808 KB | Some edges were not used |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 23808 KB | Some edges were not used |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 23784 KB | Some edges were not used |
2 | Halted | 0 ms | 0 KB | - |