# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
912875 | 2024-01-20T03:50:37 Z | 1075508020060209tc | 어르신 집배원 (BOI14_postmen) | C++14 | 23 ms | 33880 KB |
#pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second #define SZ(x) (int)(x).size() int n;int m; int ar[500005]; int br[500005]; vector<int>e[500005]; int eit[500005]; int vis[500005]; int visv[500005]; vector<vector<int>>fans; vector<int>ans; void dfs(int nw){ visv[nw]=1; for(;eit[nw]<e[nw].size();eit[nw]++){ int id=e[nw][eit[nw]]; if(vis[id]){continue;} vis[id]=1; int v=ar[id]^br[id]^nw; if(visv[v]){ vector<int>vc; while(ans.back()!=v){ vc.push_back(ans.back()); visv[nw]=0; ans.pop_back(); } vc.push_back(v); } dfs(v); } ans.push_back(nw); } signed main(){ cin>>n>>m; for(int i=1;i<=m;i++){ cin>>ar[i]>>br[i]; e[ar[i]].push_back(i); e[br[i]].push_back(i); } dfs(1); for(int i=0;i<ans.size()-1;i++){ cout<<ans[i]<<" "; }cout<<"\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 19 ms | 33624 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 20 ms | 33880 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 33688 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |