# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20590 | model_code | Martian DNA (IOI16_dna) | C++14 | 13 ms | 2024 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 "dna.h"
#include <cstdlib>
std::string zeroes(int m) {
std::string res = "";
for (int i = 0; i < m; ++i)
res += '0';
return res;
}
std::string analyse(int n, int t) {
int l = 0, r = n + 1;
while (l < r - 1) {
int m = (l + r) >> 1;
if (make_test(zeroes(m)))
l = m;
else
r = m;
}
std::string s = zeroes(l);
int zeroesCount = 0;
int maxZeroesCount = l;
while (true) {
s += '1';
if (!make_test(s)) {
s[s.size() - 1] = '0';
++zeroesCount;
} else {
zeroesCount = 0;
}
if (zeroesCount + maxZeroesCount >= n || zeroesCount >= maxZeroesCount + 1)
break;
}
l = 0, r = zeroesCount;
s = s.substr(0, s.size() - zeroesCount);
while (l < r - 1) {
int m = (l + r) >> 1;
if (make_test(s + zeroes(m)))
l = m;
else
r = m;
}
s = s + zeroes(l);
while (s.size() < n) {
s = "1" + s;
if (!make_test(s)) {
s[0] = '0';
}
}
return s;
}
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... |