| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 595775 | jophyyjh | Martian DNA (IOI16_dna) | C++14 | 14 ms | 432 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.
/**
* OK, so we have a binary str of len n. Each time we're allowed to give a str and
* whether the str is a substr of the original binary str is returned. The task is
* to determine the entire str under a certain num of interactions.
*
* Well it looks to me that the num of steps shall be O(n). Well, i think i've got
* a solution by extending the current str on either side. 2n steps is now the
* maximum. Using randomized algo, we can prove that the expected num of
* interactions <= 1.5n, which is still too much, and whether the interactor is
* adaptive remains unknown.
*
* We want to further lower the num of interactions. Can we directly determine the
* first char? Well i guess the goal is to find the suffix (or equivalently the
* prefix). In the algo above, we extend our str on the right side until it can
* no longer be extended; after this, we can just extend it on the left side,
* without fearing that a "true" response corresponds to a substr which is not a
* suffix (shifted pos). In other words, we wish to find a substr such that:
* make_test((substr)0), make_test((substr)1) are all false.
*
* Number of steps: 1.5 (expected)
* Implementation 1
*/
#include <bits/stdc++.h>
#include "dna.h"
std::string analyse(int n, int T) {
std::string current = "";
for (;;) {
std::vector<char> test({'0', '1'});
std::random_shuffle(test.begin(), test.end());
bool found = false;
for (char c : test) {
if (make_test(current + c)) {
current.push_back(c);
found = true;
break;
}
}
if (!found) // can't append any char (at the back)
break;
}
assert(int(current.size()) <= n);
while (int(current.size()) < n) {
if (make_test("0" + current))
current.insert(0, 1, '0');
else
current.insert(0, 1, '1');
}
return current;
}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... | ||||
