# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
471950 | 2021-09-11T22:59:24 Z | nickmet2004 | Hidden Sequence (info1cup18_hidden) | C++11 | 3 ms | 456 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; int Q,k,n0,n1,L; vector<int> ans; int ask(int x , int y, int A){ vector<int> v; while(x--) v.emplace_back(A); while(y--) v.emplace_back(A^1); int w = 0; if(L)w=L-x; while(w--) v.emplace_back(A); return isSubsequence(v); } vector<int> findSequence(int n){ ans.resize(n); for(int i = 1; i <= n; ++i){ if(!ask(i,0,0)){ n0 = i - 1; n1 = n - n0; break; } } if(n0<n1) {Q^=1; swap(n0 , n1);} k=n; int P = n0; L = n0; while(1){ if(P==1)break; int one= 1; while(1){ if(!ask(P , one , Q)){ one--; k-= one-1; ans[k] = 1; P--; break; } one++; } } for(int i = 0; i < n; ++i){ if(ans[i]) ans[i] = Q; else ans[i] = Q^1; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 328 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |