# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
963350 | Kalata_56 | Martian DNA (IOI16_dna) | C++17 | 0 ms | 0 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<bits/stdc++.h>
using namespace std;
string dna;
string dna2;
string analyse(int n,int t){
int l=0,r=n+1;
while(l<r-1){
int mid=(l+r);
dna="";
for(int i=0;i<mid;i++){
dna+="0";
}
if(make_test(dna)){
l=mid;
}else{
r=mid;
}
}
dna="";
if(l==0){
for(int i=0;i<n;i++){
dna+="1";
}
return dna;
}
for(int i=0;i<l;i++){
dna+="0";
}
int kolko=0;
while(kolko<=l){
dna+="1";
if(make_test(dna)){
kolko=0;
}else{
dna.pop_back();
dna.push_back('1');
kolko++;
}
}
while(dna[dna.size()-1]=='0'){
dna.pop_back();
}
l=0;
r=n+1;
while(l<r-1){
int mid=(l+r)/2;
for(int i=0;i<mid;i++){
dna+="0";
}
if(make_test(dna)){
l=mid;
}else{
r=mid;
}
for(int i=0;i<mid;i++){
dna.pop_back();
}
}
for(int i=dna.size();i<n;i++){
dna2="0"+dna;
if(make_test(dna2)){
dna=dna2;
}else{
dna="1"+dna;
}
}
return dna;
}