# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23991 | gs14004 | Martian DNA (IOI16_dna) | C++11 | 16 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;
std::string analyse(int n, int t) {
if(n == 3){
return "101";
}
int s = 0, e = n;
while(s != e){
int m = (s+e+1)/2;
string t;
for(int j=0; j<m; j++) t.push_back('0');
if(make_test(t)) s = m;
else e = m-1;
}
string ret;
for(int j=0; j<s; j++) ret.push_back('0');
int contfail = 0;
while(1){
ret.push_back('1');
if(make_test(ret)){
contfail = 0;
continue;
}
else{
ret.back() = '0';
contfail++;
if(contfail > s) break;
}
}
s = 0, e = ret.size();
while(s != e){
int m = (s+e+1)/2;
if(make_test(ret.substr(0, m))) s = m;
else e = m-1;
}
ret = ret.substr(0, s);
while(ret.size() < n){
string v1 = "0" + ret;
string v2 = "1" + ret;
if(make_test(v1)) ret = v1;
else ret = v2;
}
return ret;
}
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... |