제출 #733350

#제출 시각아이디문제언어결과실행 시간메모리
733350Trunkty어르신 집배원 (BOI14_postmen)C++14
100 / 100
489 ms119668 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll int n,m; vector<pair<int,int>> roads[500005]; int poi[500005]; bool mark[500005]; bool vis[500005]; vector<int> curr; vector<vector<int>> ans; void euler(int x){ if(vis[x]){ curr = {x}; return; } vis[x] = true; while(roads[x].size()!=poi[x]){ pair<int,int> p = roads[x][poi[x]]; poi[x]++; if(mark[p.second]){ continue; } mark[p.second] = true; euler(p.first); if(curr.size()>0 and curr[0]!=x){ curr.push_back(x); vis[x] = false; return; } else if(curr[0]==x){ ans.push_back(curr); curr.clear(); } } } signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; for(int i=1;i<=m;i++){ int a,b; cin >> a >> b; roads[a].push_back({b,i}); roads[b].push_back({a,i}); } for(int i=1;i<=n;i++){ if(roads[i].size()>0){ euler(i); } } for(vector<int> i:ans){ for(int j:i){ cout << j << " "; } cout << "\n"; } return 0; }

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

postmen.cpp: In function 'void euler(ll)':
postmen.cpp:20:26: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   20 |     while(roads[x].size()!=poi[x]){
      |           ~~~~~~~~~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...