제출 #941126

#제출 시각아이디문제언어결과실행 시간메모리
941126Sir_Ahmed_Imran어르신 집배원 (BOI14_postmen)C++17
100 / 100
377 ms90596 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define ll long long #define append push_back #define add insert #define nl "\n" #define ff first #define ss second #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL) #define N 500001 int st; int vis[N]; int evis[N]; vector<int> x; vector<pii> a[N]; void dfs(int v){ int u; vis[v]=1; x.append(v); while(!a[v].empty()){ while(!a[v].empty() && evis[a[v].back().ss]) a[v].pop_back(); if(a[v].empty()){ x.pop_back(); return; } u=a[v].back().ff; evis[a[v].back().ss]=1; if(vis[u]){ cout<<u<<' '; while(x.back()!=u){ cout<<x.back()<<' '; vis[x.back()]=0; x.pop_back(); } cout<<nl; st=u; } else dfs(u); if(v!=st) return; } } void solve(){ int n,m,o,p,q,r; cin>>n>>m; for(int i=0;i<m;i++){ cin>>p>>q; a[p].append({q,i}); a[q].append({p,i}); } for(int i=1;i<=n;i++) dfs(i); } int main(){ L0TA; solve(); return 0; }

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

postmen.cpp: In function 'void solve()':
postmen.cpp:47:13: warning: unused variable 'o' [-Wunused-variable]
   47 |     int n,m,o,p,q,r;
      |             ^
postmen.cpp:47:19: warning: unused variable 'r' [-Wunused-variable]
   47 |     int n,m,o,p,q,r;
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...