# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27889 | abcdef6199 | Martian DNA (IOI16_dna) | C++98 | 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 <bits/stdc++.h>
using namespace std;
string analyse(int n, int t) {
int l, r, f;
l = 1; r = n; f = 0;
while (l <= r) {
int mid = (l + r) >> 1;
if (make_test(string(mid, '0'))) {
f = mid;
l = mid + 1;
}
else r = mid - 1;
}
if (f == 0) return string(n, '1');
string ans(f, '0');
int cur = 0;
while (1) {
if (make_test(ans + "1")) {
cur = 0;
ans += "1";
}
else {
ans += "0";
cur += 1;
}
if (cur > l) break;
}
l = 1; r = (int) ans.size(); f = -1;
while (l <= r) {
int mid = (l + r) >> 1;
if (make_test(ans.substr(0, mid))) {
f = mid;
l = mid + 1;
}
else r = mid - 1;
}
assert(f != -1);
while ((int) ans.size() > f) ans.erase((int) ans.size() - 1);
for (int i = n - (int) ans.size(); i >= 1; --i) {
if (make_test("1" + ans)) ans = "1" + ans;
else ans = "0" + 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... |