# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244491 | 2020-07-04T07:23:20 Z | tqbfjotld | Potemkin cycle (CEOI15_indcyc) | C++14 | 1000 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; int n,e; bool adjm[15][15]; vector<int> cur; bool used[15]; bool thing(){ for (int x = 0; x<n; x++){ if (used[x]) continue; if (cur.size()>0&&!adjm[x][cur[cur.size()-1]])continue; bool possible = true; for (int y = 1; 1+y<cur.size(); y++){ if (adjm[x][cur[y]]){ possible = false; } } if (possible){ if (cur.size()>=3&&adjm[x][cur[0]]){ cur.push_back(x); return true; } if (cur.size()>1&&adjm[x][cur[0]]) continue; cur.push_back(x); used[x] = true; if (thing()){ return true; } cur.pop_back(); used[x] = false; } } return false; } int main(){ scanf("%d%d",&n,&e); for (int x = 0; x<e; x++){ int a,b; scanf("%d%d",&a,&b); a--;b--; adjm[a][b] = 1; adjm[b][a] = 1; } if (thing()){ for (int x : cur){ printf("%d ",1+x); } } else{ printf("no"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
# | 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 | 256 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
# | 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) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 384 KB | Time limit exceeded |
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 | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1094 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5 ms | 256 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5 ms | 256 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |