제출 #930915

#제출 시각아이디문제언어결과실행 시간메모리
930915Denkata어르신 집배원 (BOI14_postmen)C++14
100 / 100
463 ms76836 KiB
#include<bits/stdc++.h> using namespace std; const int maxn = 5e5+3; int i,j,p,q,n,m,k; int used[maxn],uk[maxn],came[maxn],usedge[maxn]; vector <pair <int,int>> v[maxn]; vector <vector <int>> ans; void dfs(int u) { if(used[u]){ p = u; while(used[p]) { cout<<p<<" "; used[p] = 0; p = came[p]; } cout<<endl; } while(uk[u]<v[u].size()) { int q = v[u][uk[u]].second; int edge = v[u][uk[u]].first; uk[u]++; if(!usedge[edge]) { usedge[edge] = true; used[u] = 1; came[u] = q; dfs(q); } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n>>m; for(i=1;i<=m;i++) { cin>>p>>q; v[p].push_back({i,q}); v[q].push_back({i,p}); } dfs(1); return 0; }

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

postmen.cpp: In function 'void dfs(int)':
postmen.cpp:20:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     while(uk[u]<v[u].size())
      |           ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...