# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
734549 | keta_tsimakuridze | Hidden Sequence (info1cup18_hidden) | C++14 | 7 ms | 304 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)
{
int x = 0; // naklebjer romelic gvxdeba
vector<int> v;
for(int i = 1; i <= (n / 2) + 1; i++) v.push_back(x);
if(isSubsequence(v)) x = 1;
int cx = 0;
v.clear();
for(int i = 1; i <= (n / 2) + 1; i++) {
v.push_back(x);
if(!isSubsequence(v)) {
cx = i - 1; break;
}
}
int l = 0;
vector<int> ans;
for(int i = 1; i <= cx; ) {
if(l == n - cx) {
++i;
ans.push_back(x);
continue;
}
v.clear();
if(i + n - cx - l <= n / 2 + 1) {
for(int j = 1; j <= i; j++) v.push_back(x);
for(int j = 1; j <= n - cx - l; j++) v.push_back(!x);
if(isSubsequence(v)) ++i, ans.push_back(x);
else ans.push_back(!x), ++l;
} else {
for(int j = 1; j <= l +1; j++) v.push_back(!x);
for(int j = 1; j <= cx - i + 1; j++) v.push_back(x);
if(!isSubsequence(v)) ++i, ans.push_back(x);
else ans.push_back(!x), ++l;
}
}
while(l < n - cx) ++l, ans.push_back(!x);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |