# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
591566 | 2022-07-07T15:14:10 Z | andrei_boaca | Potemkin cycle (CEOI15_indcyc) | C++14 | 939 ms | 2036 KB |
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; mt19937 rng(time(NULL)); vector<int> muchii[1005]; auto S=chrono::steady_clock::now(); int n,m; vector<int> v; bool use[1005]; int start=0; void dfs(int nod) { auto E=chrono::steady_clock::now(); int x=chrono::duration_cast<chrono::milliseconds>(E - S).count(); if(x>=950) { cout<<"no"; exit(0); } use[nod]=1; bool good=1; bool ok=0; if(nod==4) { /*for(int i:v) cout<<i<<' ';*/ ok=1; } for(int i:muchii[nod]) { if(use[i]) { if(i==v[v.size()-2]) continue; if(i==start) { if(v.size()>=4) continue; else { good=0; break; } } else if(i!=v[v.size()-2]) { good=0; break; } } } if(good) { for(int i:muchii[nod]) if(i==start&&v.size()>=4) { for(int j:v) cout<<j<<' '; exit(0); } for(int i:muchii[nod]) if(!use[i]) { v.push_back(i); use[i]=1; dfs(i); use[i]=0; v.pop_back(); } } } int main() { cin>>n>>m; for(int i=1;i<=m;i++) { int a,b; cin>>a>>b; muchii[a].push_back(b); muchii[b].push_back(a); } vector<int> nodes; for(int i=1;i<=n;i++) nodes.push_back(i); shuffle(nodes.begin(),nodes.end(),rng); for(int i:nodes) { start=i; v.clear(); v.push_back(i); for(int j=1;j<=n;j++) use[j]=0; dfs(i); } cout<<"no"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 89 ms | 340 KB | Output is correct |
2 | Correct | 170 ms | 356 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 936 ms | 468 KB | Output is correct |
2 | Incorrect | 935 ms | 388 KB | Expected integer, but "no" found |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 369 ms | 384 KB | Output is correct |
2 | Correct | 933 ms | 392 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 931 ms | 1232 KB | Expected integer, but "no" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 939 ms | 748 KB | Expected integer, but "no" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 939 ms | 2036 KB | Expected integer, but "no" found |
2 | Halted | 0 ms | 0 KB | - |