Submission #42608

#TimeUsernameProblemLanguageResultExecution timeMemory
42608nonocutPotemkin cycle (CEOI15_indcyc)C++14
30 / 100
404 ms5332 KiB
#include<bits/stdc++.h> using namespace std; const int maxn = 1e3 + 5; int n,m; int c[maxn][maxn]; vector<int> a, b; int main() { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) c[i][i] = 1; for(int i=1;i<=m;i++) { int x, y; scanf("%d%d",&x,&y); c[x][y] = c[y][x] = 1; } for(int x=1;x<=n;x++) { for(int y=x+1;y<=n;y++) { if(!c[x][y]) continue; a.clear(); b.clear(); for(int i=1;i<=n;i++) { if(c[i][x] && !c[i][y]) a.push_back(i); if(c[i][y] && !c[i][x]) b.push_back(i); } for(auto t1 : a) { for(auto t2 : b) { if(c[t1][t2]) { printf("%d %d %d %d",t1,x,y,t2); return 0; } } } } } printf("no"); }

Compilation message (stderr)

indcyc.cpp: In function 'int main()':
indcyc.cpp:8:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
                        ^
indcyc.cpp:12:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x,&y);
                            ^
#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...