# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1060337 | pera | Hidden Sequence (info1cup18_hidden) | C++17 | 6 ms | 440 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int> findSequence(int N){
vector<int> ans , X , e(2);
for(int i = 1;i <= N / 2 + 1;i ++){
X.emplace_back(1);
if(isSubsequence(X)){
e[1] = i;
e[0] = N - i;
}
}
if(e[1] == N / 2 + 1){
vector<int>().swap(X);
for(int i = 1;i <= N / 2 + 1;i ++){
X.emplace_back(0);
if(isSubsequence(X)){
e[0] = i;
e[1] = N - i;
}
}
}
vector<int> o(2);
auto Get = [&](int x , int y , int z){
vector<int> v;
for(int i = 1;i <= x + y;i ++){
v.push_back(z ^ (i > x));
}
return v;
};
auto is_Zero = [&](){
if(o[0] + (e[1] - o[1]) <= N / 2 + 1){
return isSubsequence(Get(o[0] + 1 , e[1] - o[1] , 0));
}else{
return !isSubsequence(Get(o[1] + 1 , e[0] - o[0] , 1));
}
};
for(int i = 1;i <= N;i ++){
ans.emplace_back(!is_Zero());
o[ans.back()]++;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |