# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
896101 | 2023-12-31T18:50:31 Z | Servant_of_the_Lord | 어르신 집배원 (BOI14_postmen) | C++17 | 2 ms | 860 KB |
#include<bits/stdc++.h> #define ll long long using namespace std; main() { ll x,y,z,a,b,c; ios_base::sync_with_stdio(0); cin.tie(0); cin>>x>>y; vector<vector<pair<ll,ll>>>v(x); vector<ll>w(y); vector<ll>u; vector<bool>t(x); for(ll i=0;i<y;i++) { cin>>a>>b; a--,b--; v[a].push_back({b,i}); v[b].push_back({a,i}); } function<void(ll)>dfs=[&](ll a) { if(t[a]) { while(u.back()!=a) { cout<<u.back()+1<<' '; t[u.back()]=false; u.pop_back(); } cout<<a+1<<'\n'; u.pop_back(); } u.push_back(a); t[a]=true; while(v[a].size()) { pair<ll,ll>p=v[a].back(); v[a].pop_back(); if(w[p.second])continue; w[p.second]=true; dfs(p.first); } }; dfs(0); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 860 KB | Output is correct |
5 | Incorrect | 1 ms | 604 KB | Some edges were not used |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 860 KB | Output is correct |
5 | Incorrect | 1 ms | 600 KB | Some edges were not used |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 860 KB | Output is correct |
5 | Incorrect | 0 ms | 604 KB | Some edges were not used |
6 | Halted | 0 ms | 0 KB | - |