Submission #25116

# Submission time Handle Problem Language Result Execution time Memory
25116 2017-06-20T07:10:56 Z 윤교준(#1055) Potemkin cycle (CEOI15_indcyc) C++11
30 / 100
33 ms 2028 KB
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#define pb push_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[(sz(V)-2)])
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (1100000099)
#define INFLL (1100000000000000099ll)
#define MAXN (105)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;

bool chk[MAXN][MAXN];
int N, M;

int main() {
    for(scanf("%d%d", &N, &M); M--;) {
        int s, e; scanf("%d%d", &s, &e); chk[s][e] = chk[e][s] = true;
    }
    for(int a = 1; a <= N; a++) {
        for(int b = 1; b <= N; b++) {
            if(a == b || !chk[a][b]) continue;
            for(int c = 1; c <= N; c++) {
                if(a == c || b == c || !chk[b][c]) continue;
                for(int d = 1; d <= N; d++) {
                    if(a == d || b == d || c == d || !chk[c][d] || !chk[d][a]) continue;
                    if(chk[a][c] || chk[b][d]) continue;
                    printf("%d %d %d %d\n", a, b, c, d);
                    return 0;
                }
            }
        }
    }
    puts("no");
    return 0;
}

Compilation message

indcyc.cpp: In function 'int main()':
indcyc.cpp:38:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(scanf("%d%d", &N, &M); M--;) {
                              ^
indcyc.cpp:39:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int s, e; scanf("%d%d", &s, &e); chk[s][e] = chk[e][s] = true;
                                        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2028 KB Output is correct
2 Correct 0 ms 2028 KB Output is correct
3 Correct 0 ms 2028 KB Output is correct
4 Correct 0 ms 2028 KB Output is correct
5 Correct 0 ms 2028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2028 KB Output is correct
2 Correct 0 ms 2028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2028 KB Expected integer, but "no" found
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 2028 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -