# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
373409 | Ahmad_Hasan | 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.
string analyse(int n, int t) {
make_test("0");
string ons="";
for(int i=0;i<n;i++)
ons+='1';
int l=0,r=n;
int cnt1=0;
///cout<<ons<<'\n';
while(l<=r){
int mid=(r-l)/2+l;
///cout<<ons.substr(0,mid)<<'\n';
if(make_test(ons.substr(0,mid))){
l=mid+1;
cnt1=mid;
}else{
r=mid-1;
}
}
///cout<<cnt1<<'\n';
ons=ons.substr(0,cnt1);
int cnt=0;
while(cnt<=cnt1){
if(make_test(ons+'0')){
cnt=0;
ons+='0';
}else{
cnt++;
ons+='1';
}
}
l=cnt1,r=n;
int lst=0;
///cout<<ons<<'\n';
while(l<=r){
int mid=(r-l)/2+l;
///cout<<ons.substr(0,mid)<<'\n';
if(make_test(ons.substr(0,mid))){
l=mid+1;
lst=mid;
}else{
r=mid-1;
}
}
ons=ons.substr(0,lst);
while(ons.size()<n){
if(make_test("0"+ons)){
ons.insert(0,'0',1);
}else{
ons.insert(0,'1',1);
}
}
return ons;
}