제출 #896454

#제출 시각아이디문제언어결과실행 시간메모리
896454Servant_of_the_Lord어르신 집배원 (BOI14_postmen)C++17
100 / 100
363 ms87480 KiB
#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(); } while(v[a].size()) { pair<ll,ll>p=v[a].back(); v[a].pop_back(); if(w[p.second])continue; w[p.second]=true; u.push_back(a); t[a]=true; dfs(p.first); } }; dfs(0); }

컴파일 시 표준 에러 (stderr) 메시지

postmen.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~
postmen.cpp: In function 'int main()':
postmen.cpp:8:12: warning: unused variable 'z' [-Wunused-variable]
    8 |     ll x,y,z,a,b,c;
      |            ^
postmen.cpp:8:18: warning: unused variable 'c' [-Wunused-variable]
    8 |     ll x,y,z,a,b,c;
      |                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...