| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 439707 | zxcvbnm | Martian DNA (IOI16_dna) | C++14 | 15 ms | 392 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;
std::string analyse(int n, int t) {
// randame ilgiausia eile, turincia tik nulius
int l = 0, r = n+1, ans = 0;
while(l <= r) {
int mid = (l + r) / 2;
if (make_test(string(mid, '0'))) {
l = mid + 1;
ans = mid;
} else {
r = mid - 1;
}
}
if (ans == 0) {
return string(n, '1');
}
string str = string(ans, '0');
int rep = 0;
int len = ans;
while(rep <= len) {
if (!make_test(str + "1")) {
rep++;
str += "0";
} else {
rep = 0;
str += "1";
}
}
str = str.substr(0, (int) str.length()-len-1);
l = 0, r = n+1;
int zeros = 0;
while(l <= r) {
int mid = (l + r) / 2;
if (make_test(str + string(mid, '0'))) {
l = mid + 1;
zeros = mid;
} else {
r = mid - 1;
}
}
str += string(zeros, '0');
while(1) {
if (!make_test(str + "0")) break;
str += "0";
}
while((int) str.length() < n) {
if (make_test("1" + str)) {
str = "1" + str;
} else {
str = "0" + str;
}
}
return str;
}
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... | ||||
