제출 #941113

#제출 시각아이디문제언어결과실행 시간메모리
941113Sir_Ahmed_Imran어르신 집배원 (BOI14_postmen)C++17
55 / 100
505 ms117716 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; set<int> a[N]; vector<int> x; int vis[N]; void dfs(int v){ int u; vis[v]=1; x.append(v); while(!a[v].empty()){ u=*a[v].begin(); a[v].erase(u); a[u].erase(v); 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].add(q); a[q].add(p); } for(int i=1;i<=n;i++) if(!a[i].empty()) dfs(i); } int main(){ L0TA; solve(); return 0; }

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

postmen.cpp: In function 'void solve()':
postmen.cpp:41:13: warning: unused variable 'o' [-Wunused-variable]
   41 |     int n,m,o,p,q,r;
      |             ^
postmen.cpp:41:19: warning: unused variable 'r' [-Wunused-variable]
   41 |     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...