# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
44720 | 2018-04-05T12:31:59 Z | Pajaraja | 어르신 집배원 (BOI14_postmen) | C++17 | 21 ms | 23812 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;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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 23808 KB | Some edges were not used |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 23812 KB | Some edges were not used |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 23808 KB | Some edges were not used |
2 | Halted | 0 ms | 0 KB | - |