# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95852 | 2019-02-03T07:24:37 Z | Kastanda | Potemkin cycle (CEOI15_indcyc) | C++11 | 1000 ms | 1404 KB |
#include<bits/stdc++.h> using namespace std; const int N = 1009; int n, m, qu[N], P[N]; bitset < N > M, S, is[N]; vector < int > Adj[N]; inline void Prnt(int fxd, int v, int u) { M = S = 0; memset(P, 0, sizeof(P)); for (int &w : Adj[fxd]) M[w] = 1; int l = 0, r = 0; qu[r ++] = v; S[v] = 1; while (r - l) { int nw = qu[l ++]; for (int &w : Adj[nw]) if (w != fxd && !S[w] && !(M[nw] && M[w])) { S[w] = 1; P[w] = nw; if (!M[w]) qu[r ++] = w; } } if (P[u] == 0) return ; vector < int > A; A.push_back(fxd); for (; u; u = P[u]) A.push_back(u); for (int i = 0; i < (int)A.size(); i++) for (int j = i + 2; j < (int)A.size(); j++) if ((i != 0 || j != (int)A.size() - 1) && is[A[i]][A[j]]) assert(0); for (int a : A) printf("%d ", a); printf("\n"); exit(0); } int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; i++) { int v, u; scanf("%d%d", &v, &u); Adj[v].push_back(u); Adj[u].push_back(v); is[v][u] = is[u][v] = 1; } for (int fxd = 1; fxd <= n; fxd ++) for (int v : Adj[fxd]) for (int u : Adj[fxd]) if (v < u && !is[v][u]) Prnt(fxd, v, u); return !printf("no\n"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 10 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 134 ms | 504 KB | Output is correct |
2 | Correct | 3 ms | 504 KB | Output is correct |
3 | Correct | 3 ms | 504 KB | Output is correct |
4 | Correct | 99 ms | 508 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Correct | 96 ms | 508 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 718 ms | 1056 KB | Output is correct |
2 | Correct | 99 ms | 760 KB | Output is correct |
3 | Execution timed out | 1063 ms | 1016 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 760 KB | Output is correct |
2 | Execution timed out | 1069 ms | 760 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 44 ms | 1300 KB | Output is correct |
2 | Correct | 306 ms | 1404 KB | Output is correct |
3 | Correct | 212 ms | 1144 KB | Output is correct |
4 | Execution timed out | 1069 ms | 1272 KB | Time limit exceeded |