# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831616 | KemalK | Martian DNA (IOI16_dna) | C++17 | 20 ms | 476 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>
#include <cstdlib>
using namespace std;
std::string analyse(int n, int t) {
string ans = "";
if (n <= 5){
bool ok = false;
for (int mask = 0; mask < (1<<n) - 1; mask++){
string cur = "";
for (int j = 0; j < n; j++){
if (mask>>j&1){
cur += "1";
}
else{
cur += "0";
}
}
ok = make_test(cur);
if (ok){
return cur;
}
}
if (!ok){
for(int i = 0; i < n; i++){
ans += "1";
}
return ans;
}
}
bool left = true;
bool right = true;
while(ans.size() != n){
if (ans.size() == 0){
string cur = ans + "0";
string cur2 = ans + "1";
bool ok = make_test(cur);
bool ok2 = make_test(cur2);
if (!ok){
for (int i = 0; i < n; i++){
ans += "1";
}
return ans;
}
else if (!ok2){
for (int i = 0; i < n; i++){
ans += "0";
}
return ans;
}
ans += "0";
}
else{
cout << "second " << "\n";
if (left){
string cur = ans + "1";
string cur2 = ans + "0";
bool ok = make_test(cur);
bool ok2 = make_test(cur2);
if (!ok and !ok2){
left = false;
}
else if (ok){
ans += "1";
}
else{
ans += "0";
}
}
else{
string cur = "0" + ans;
string cur2 = "1" + ans;
bool ok = make_test(cur);
bool ok2 = make_test(cur2);
if (ok){
ans = "0" + ans;
}
else{
ans = "1" + ans;
}
}
}
}
return ans;
}
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... |