# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
963360 | biank | Hidden Sequence (info1cup18_hidden) | C++14 | 4 ms | 948 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;
#define sz(x) int(x.size())
bool query(vector<int> s, int c) {
s.push_back(1);
while (c--) s.push_back(0);
return isSubsequence(s);
}
vector<int> findSequence(int N) {
int l = 0, r = N + 1;
vector<int> s;
while (l + 1 < r) {
int m = (l + r) / 2;
while (sz(s) > m) s.pop_back();
while (sz(s) < m) s.push_back(0);
if (isSubsequence(s)) {
l = m;
} else {
r = m;
}
}
int n = l, m = N - l;
vector<int> ans;
int i = 0, j = 0;
while (i < n || j < m) {
if (i >= n || (j < m && query(ans, n - i))) {
ans.push_back(1);
j++;
} else {
ans.push_back(0);
i++;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |