Submission #99648

# Submission time Handle Problem Language Result Execution time Memory
99648 2019-03-06T03:52:10 Z adlet Potemkin cycle (CEOI15_indcyc) C++17
0 / 100
1000 ms 5156 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define ios ios_base::sync_with_stdio(0), cin.tie(0)

using namespace std;

typedef long long ll;

const int N = 1e3 + 5;
const int mod = 1e9 + 7;
const int INF = 1e9;
const double PI = acos(-1.0);

int n, m, a[N][N];

vector < int > g[N], vec;

int main() {
    cin >> n >> m;
    for (int i = 1, v, u; i <= m; ++i) {
        cin >> v >> u;
        a[v][u] = 1;
        a[u][v] = 1;
        g[v].push_back(u);
        g[u].push_back(v);
    }
    for (int i = 1; i <= n; ++i)
        vec.push_back(i);
    do {
        for (int i = 1; i < n; ++i) {
            if (a[vec[i]][vec[i - 1]] == 0) {
                if (i - 1 >= 3 && a[vec[i - 1]][vec[0]]) {
                    for (int j = 0; j < i; ++j) {
                        cout << vec[j] << " ";
                    }
                    cout << "\n";
                    return 0;
                }
                break;
            }
            for (int j = 1; j < i; ++j) {
                if (a[vec[i]][vec[j]]) {
                    break;
                }
            }
        }
    } while (next_permutation(vec.begin(), vec.end()));
    cout << "no";
}
/**
clock() / (double)CLOCKS_PER_SEC < 1.9

*/
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Wrong adjacency
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Wrong adjacency
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 768 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 768 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1040 ms 1532 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 1664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 5156 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 4864 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 3704 KB Wrong adjacency
2 Halted 0 ms 0 KB -