제출 #172951

#제출 시각아이디문제언어결과실행 시간메모리
172951phillipPotemkin cycle (CEOI15_indcyc)C++14
50 / 100
123 ms504 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; int vis[109],org; vector<int>cc,v[109]; void out() { for(int i=0;i<cc.size();i++)cout<<cc[i]+1<<" "; exit(0); } void dfs(int x,int par) { //cout<<x<<" "<<par<<"\n"; cc.push_back(x); for(int i=0;i<v[x].size();i++) { if(v[x][i]==par)continue; if(vis[v[x][i]]) { if(v[x][i]==org&&cc.size()>=4)continue; cc.pop_back(); return; } } for(int i=0;i<v[x].size();i++) { if(v[x][i]==par)continue; if(v[x][i]==org&&cc.size()>=4)out(); } vis[x]=1; for(int i=0;i<v[x].size();i++) { int y=v[x][i]; if(y==par)continue; dfs(y,x); } cc.pop_back(); vis[x]=0; } int n,m,x,y; int main() { cin>>n>>m; for(int i=0;i<m;i++) { cin>>x>>y; x--;y--; v[x].push_back(y); v[y].push_back(x); } for(int i=0;i<n;i++) { memset(vis,0,sizeof(vis)); org=i; dfs(i,i); } cout<<"no"; }

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

indcyc.cpp: In function 'void out()':
indcyc.cpp:8:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<cc.size();i++)cout<<cc[i]+1<<" ";
                 ~^~~~~~~~~~
indcyc.cpp: In function 'void dfs(int, int)':
indcyc.cpp:15:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v[x].size();i++)
                 ~^~~~~~~~~~~~
indcyc.cpp:25:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v[x].size();i++)
                 ~^~~~~~~~~~~~
indcyc.cpp:31:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v[x].size();i++)
                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...