# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
932974 | skyvn97 | Martian DNA (IOI16_dna) | C++14 | 25 ms | 600 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.
#ifndef SKY
#include "dna.h"
#endif // SKY
#include <bits/stdc++.h>
using namespace std;
#ifdef SKY
string analyse(int, int);
struct Jury {
static const int QUERY_LIMIT = 256;
string s;
int queryCount;
void init(void) {
int len = rand() % 10 + 1;
s.clear();
for (int i = 0; i < len; i++) s.push_back(rand() % 2 ? '0' : '1');
queryCount = 0;
}
bool make_test(const string &p) {
assert(++queryCount <= QUERY_LIMIT);
if (p.size() > s.size()) return false;
for (int i = 0; i <= s.size() - p.size(); i++) {
bool ok = true;
for (int j = 0; j < p.size(); j++) if (s[i + j] != p[j]) {
ok = false; break;
}
if (ok) return true;
}
return false;
}
void process(void) {
string r = analyse(s.size(), QUERY_LIMIT);
assert(r == s);
if (r != s) printf("Expected %s, received %s\n", s.c_str(), r.c_str());
else printf("ACCEPTED after %d queries\n", queryCount);
}
} jury;
bool make_test(string p) {
return jury.make_test(p);
}
#endif // SKY
std::string analyse(int n, int t) {
if (!make_test("1")) return string(n, '0');
string res = "1";
while ((int)res.size() < n) {
if (make_test(res + "0")) res += "0";
else if (make_test(res + "1")) res += "1";
else if (make_test("0" + res)) res = "0" + res;
else res = "1" + res;
}
return res;
}
#ifdef SKY
int main(void) {
for (int i = 0; i < 1000; i++) {
jury.init();
jury.process();
}
return 0;
}
#endif // SKY
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... |