Submission #42608

# Submission time Handle Problem Language Result Execution time Memory
42608 2018-03-01T09:35:40 Z nonocut Potemkin cycle (CEOI15_indcyc) C++14
30 / 100
404 ms 5332 KB
#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

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 time Memory Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 1 ms 464 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 620 KB Output is correct
2 Correct 1 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1116 KB Expected integer, but "no" found
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1116 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1912 KB Output is correct
2 Incorrect 8 ms 1992 KB Expected integer, but "no" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1996 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 404 ms 5168 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 251 ms 5332 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 225 ms 5332 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -