# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244432 | 2020-07-04T05:48:08 Z | dantoh000 | Potemkin cycle (CEOI15_indcyc) | C++14 | 276 ms | 768 KB |
#include <bits/stdc++.h> using namespace std; int n,m; vector<int> G[305]; int K[305][305]; int p[305]; queue<int> q; int main(){ scanf("%d%d",&n,&m); for (int i = 0; i < m; i++){ int u,v; scanf("%d%d",&u,&v); G[u].push_back(v); G[v].push_back(u); K[u][v] = K[v][u] = 1; } for (int i = 1; i <= n; i++) K[i][i] = 1; for (int i = 1; i <= n; i++){ for (auto U : G[i]){ for (auto V : G[i]){ if (!K[U][V]){ //printf("test %d %d %d\n",i,U,V); p[U] = U; q.push(U); while (q.size()){ int u = q.front(); q.pop(); for (auto v: G[u]){ if ((v == V || !K[v][i]) && p[v] == 0){ p[v] = u; //printf("%d -> %d\n",u,v); q.push(v); } } } if (p[V]){ vector<int> ans; int cur = V; while (cur != U){ ans.push_back(cur); cur = p[cur]; } ans.push_back(U); ans.push_back(i); for (auto x : ans) printf("%d ",x); return 0; } for (int i = 1; i <= n; i++) p[i] = 0; } } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Unexpected end of file - token expected |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Unexpected end of file - token expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Incorrect | 17 ms | 512 KB | Unexpected end of file - token expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 276 ms | 768 KB | Unexpected end of file - token expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 768 KB | Output is correct |
2 | Incorrect | 207 ms | 768 KB | Unexpected end of file - token expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 384 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 | 5 ms | 384 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 | 5 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |