# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
6085 | 2014-06-19T18:17:19 Z | baneling100 | 어르신 집배원 (BOI14_postmen) | C++ | 30 ms | 24400 KB |
#include <stdio.h> #include <algorithm> #include <list> using namespace std; typedef pair <int,int> ppair; list <ppair> A[500001]; int N, M, Ban[500001], Ans[500001], Top, S[500001], Len, Check[500001]; void input(void) { int i, u, v; scanf("%d %d",&N,&M); for(i=1 ; i<=M ; i++) { scanf("%d %d",&u,&v); A[u].push_back(make_pair(v,i)); A[v].push_back(make_pair(u,i)); } } void process(int now) { list <ppair> :: iterator it; int i, t1, t2; it=A[now].begin(); while(it!=A[now].end()) { t1=(*it).first; t2=(*it).second; A[now].erase(it++); if(Ban[t2]==0) { Ban[t2]=1; process(t1); } } Ans[++Top]=now; } void output(void) { int i; for(i=1 ; i<=Top ; i++) { if(Check[Ans[i]]) { while(S[Len]!=Ans[i]) { printf("%d ",S[Len]); Check[S[Len]]=0; Len--; } printf("%d\n",S[Len]); } else { Check[Ans[i]]=1; S[++Len]=Ans[i]; } } } int main(void) { input(); process(1); output(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 29 ms | 24400 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 30 ms | 24192 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 25 ms | 24192 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |