# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
775177 | anha3k25cvp | Martian DNA (IOI16_dna) | C++14 | 64 ms | 512 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 "dna.h"
using namespace std;
string analyse(int n, int t) {
int type = 0;
string ans;
while (n) {
type ^= 1;
string S = ans;
S += '0' + type;
int add_right = make_test(S);
if (add_right) {
int lo = 1, hi = n;
while (lo < hi) {
int mid = (lo + hi + 1) / 2;
S = ans;
for (int i = 1; i <= mid; i ++)
S += '0' + type;
int val = make_test(S);
if (val)
lo = mid;
else
hi = mid - 1;
}
n -= lo;
for (int i = 1; i <= lo; i ++)
ans += '0' + type;
continue;
}
int lo = 0, hi = n;
while (lo < hi) {
int mid = (lo + hi + 1) / 2;
S = "";
for (int i = 1; i <= mid; i ++)
S += '0' + type;
S += ans;
int val = make_test(S);
if (val)
lo = mid;
else
hi = mid - 1;
}
n -= lo;
for (int i = 1; i <= lo; i ++)
ans = char('0' + type) + ans;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |