제출 #1054064

#제출 시각아이디문제언어결과실행 시간메모리
1054064warrenn어르신 집배원 (BOI14_postmen)C++14
0 / 100
7 ms18524 KiB
#include<bits/stdc++.h> using namespace std; #define int long long vector<pair<int,int> >adj[500002]; int sz[500002]; bool edge[500002]; bool node[500002]; vector<int>ans; int last[500002]; vector<int>simpan; void dfs(int q){ if(node[q]==true){ while(!ans.empty()){ int tmp=ans.back(); if(tmp==q){ cout<<q<<endl; break; } else{ cout<<tmp<<" "; node[tmp]=false; ans.pop_back(); } } } else{ ans.push_back(q); } node[q]=true; for(int u=last[q];u<adj[q].size();u++){ pair<int,int>r=adj[q][u]; if(edge[r.second]==false){ edge[r.second]=true; sz[q]--; sz[r.first]--; dfs(r.first); last[q]++; break; } else{ last[q]++; } } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,m; cin>>n>>m; int cnt=1; for(int q=1;q<=m;q++){ int u,v; cin>>u>>v; sz[u]++; sz[v]++; adj[u].push_back({v,cnt}); adj[v].push_back({u,cnt}); cnt++; } for(int q=1;q<=n;q++){ if(sz[q]>0){ memset(node,false,sizeof node); dfs(q); } } }

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

postmen.cpp: In function 'void dfs(long long int)':
postmen.cpp:34:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int u=last[q];u<adj[q].size();u++){
      |                       ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...