# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42608 | nonocut | Potemkin cycle (CEOI15_indcyc) | C++14 | 404 ms | 5332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |