# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72685 | memikakizaki | Hidden Sequence (info1cup18_hidden) | C++14 | 13 ms | 628 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 "grader.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> findSequence(int n) {
int cnt_small = 0, small = 0;
vector<int> tmp;
while(cnt_small <= n / 2) {
tmp.push_back(0);
if(!isSubsequence(tmp))
break;
++cnt_small;
}
if(cnt_small == n / 2 + 1) {
cnt_small = 0;
tmp.clear();
small = 1;
while(cnt_small <= n / 2) {
tmp.push_back(1);
if(!isSubsequence(tmp))
break;
++cnt_small;
}
}
int l_larges = 0, r_larges = n - cnt_small;
vector<int> ans;
for(int sect = 0; sect <= cnt_small; sect++) {
bool valid = true;
while(valid && r_larges) {
vector<int> query_vec;
if(cnt_small - sect + l_larges <= sect + r_larges) {
for(int i = 0; i < l_larges + 1; i++)
query_vec.push_back(small ^ 1);
for(int i = 0; i < cnt_small - sect; i++)
query_vec.push_back(small);
if(isSubsequence(query_vec)) {
ans.push_back(small ^ 1);
++l_larges;
--r_larges;
} else
valid = false;
} else {
for(int i = 0; i < sect + 1; i++)
query_vec.push_back(small);
for(int i = 0; i < r_larges; i++)
query_vec.push_back(small ^ 1);
if(!isSubsequence(query_vec)) {
ans.push_back(small ^ 1);
++l_larges;
--r_larges;
} else
valid = false;
}
}
if(sect != cnt_small)
ans.push_back(small);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |