| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 51586 | MatheusLealV | Martian DNA (IOI16_dna) | C++17 | 17 ms | 640 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;
int bsearch1(int n)
{
int ini = 1, fim = n, mid, best;
while(fim >= ini)
{
mid = (ini + fim)/2;
string aux;
for(int i = 1; i <= mid; i++) aux += "0";
if(make_test(aux)) best = mid, ini = mid + 1;
else fim = mid - 1;
}
return best;
}
string analyse(int n, int t)
{
string ans, S, resp;
int mz = bsearch1(n);
for(int i = 0; i < mz; i++) ans += "0";
for(int i = 1; i <= n - mz; i++)
{
if(make_test(ans + "1")) ans += "1";
else
{
int qtdz = 0;
for(int j = ans.size() - 1; j >= 0; j--)
{
if(ans[j] != '0') break;
qtdz ++;
}
if(qtdz > mz) break;
ans += "0";
}
}
int ini = mz + 1, fim = n - 1, mid, best;
while(fim >= ini)
{
mid = (ini + fim)/2;
string aux;
for(int i = 0; i <= mid; i++) aux += ans[i];
if(make_test(aux)) best = mid, ini = mid + 1;
else fim = mid - 1;
}
for(int i = 0; i <= best; i++) S += ans[i];
for(int resta = 1; resta < n - best; resta ++)
{
if(make_test("1" + S)) S = "1" + S;
else S = "0" + S;
}
return S;
} 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... | ||||
