# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1126155 | Captain_Georgia | Hidden Sequence (info1cup18_hidden) | C++20 | 6 ms | 428 KiB |
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int> findSequence (int N) {
int low = 0, high = N + 1;
while (low < high) {
int mid = (low + high + 1) / 2;
vector<int> tmp(mid, 0);
if (isSubsequence (tmp) == true) {
low = mid;
} else {
high = mid - 1;
}
}
vector<int> answer;
int cnt_zero = low;
N -= low;
for (int i = 0;i <= cnt_zero;i ++) {
low = 0;
high = N + 1;
while (low < high) {
int mid = (low + high + 1) / 2;
vector<int> tmp;
for (int j = 0;j < i;j ++) {
tmp.push_back(0);
}
for (int j = 0;j < mid;j ++) {
tmp.push_back(1);
}
for (int j = i;j < cnt_zero;j ++) {
tmp.push_back(0);
}
if (isSubsequence (tmp) == true) {
low = mid;
} else {
high = mid - 1;
}
}
for (int j = 0;j < low;j ++) {
answer.push_back(1);
}
if (i < cnt_zero) answer.push_back(0);
N -= low;
}
return answer;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |