# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44769 | 2018-04-06T06:49:44 Z | RayaBurong25_1 | Potemkin cycle (CEOI15_indcyc) | C++17 | 1000 ms | 2964 KB |
#include <stdio.h> #include <vector> std::vector<int> AdjList[1005]; std::vector<int> Path; std::vector<int> Ans; int Vis[1005]; void dfs(int r, int u, int pa) { Vis[u] = 1; Path.push_back(u); int i, v, s = AdjList[u].size(); int ok = Path.size() >= 4; for (i = 0; i < s; i++) { v = AdjList[u][i]; if (Vis[v] && v != pa) { if (v == r && Path.size() >= 4) { // Ans = Path; } else { ok = 0; Path.pop_back(); Vis[u] = 0; return; } } } if (ok) Ans = Path; for (i = 0; i < s; i++) { v = AdjList[u][i]; if (!Vis[v]) { dfs(r, v, u); } } Path.pop_back(); Vis[u] = 0; } int main() { int N, R; scanf("%d %d", &N, &R); int i, u, v; for (i = 0; i < R; i++) { scanf("%d %d", &u, &v); AdjList[u].push_back(v); AdjList[v].push_back(u); } for (i = 1; i <= N; i++) { dfs(i, i, 0); } if (Ans.size() > 0) { for (i = 0; i < Ans.size(); i++) printf("%d ", Ans[i]); } else printf("no"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 2 ms | 528 KB | Output is correct |
4 | Correct | 2 ms | 528 KB | Output is correct |
5 | Correct | 2 ms | 584 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 588 KB | Wrong adjacency |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 592 KB | Wrong adjacency |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1068 ms | 684 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 192 ms | 820 KB | Wrong adjacency |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1074 ms | 820 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1069 ms | 820 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1079 ms | 1660 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1079 ms | 1660 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1072 ms | 2964 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |