제출 #31538

#제출 시각아이디문제언어결과실행 시간메모리
31538Dat160601어르신 집배원 (BOI14_postmen)C++14
0 / 100
14 ms12160 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second int n,u,v,m,vis[500007],num[500007]; vector < pair<int,int> > edge[500007],ed; stack <int> res; void start(int u,int p){ int over=0; for(int i=0;i<(int)edge[u].size();i++){ int v=edge[u][i].fi; //cout<<v<<endl; if(v==p) continue; int id=edge[u][i].se; if(vis[id]==1) continue; vis[id]=1; num[u]--; num[v]--; start(v,u); } if(num[u]==0){ res.push(u); } } int main(){ ios_base::sync_with_stdio(0); cin>>n>>m; for(int i=1;i<=m;i++){ cin>>u>>v; edge[u].pb(mp(v,i)); edge[v].pb(mp(u,i)); num[u]++; num[v]++; ed.pb(mp(u,v)); } int sp=0; for(int i=0;i<m;i++){ if(vis[i]==0){ start(ed[i].fi,0); int fil=0; if(sp==1) cout<<"\n"; while(!res.empty()){ fil++; if(fil==1){ res.pop(); } else if(fil==2) cout<<res.top(); else cout<<" "<<res.top(); res.pop(); } sp=1; } } }

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

postmen.cpp: In function 'void start(int, int)':
postmen.cpp:11:9: warning: unused variable 'over' [-Wunused-variable]
     int over=0;
         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...