# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1132217 | HappyCapybara | Martian DNA (IOI16_dna) | C++20 | 9 ms | 332 KiB |
#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
string analyse(int n, int t) {
string cur = "";
int a = 0;
bool b = false;
while (cur.size() < n || !b){
if (a == 10){
if (make_test(cur)) a = 0;
else {
int l = cur.size()-10, r = cur.size()+1;
//cout << l << " " << r << "\n";
while (l != r-1){
int m = (l+r)/2;
if (make_test(cur.substr(0, m))) l = m;
else r = m;
}
cur = cur.substr(0, l);
a = 0;
b = true;
if (cur.size() == n) return cur;
}
}
if (!b){
if (make_test(cur+"0")){
cur = cur+"0";
a = 0;
}
else {
cur = cur+"1";
a++;
}
}
else {
if (make_test("0"+cur)) cur = "0"+cur;
else cur = "1"+cur;
}
//cout << cur << "\n";
}
return cur;
}
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... |