# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
388365 | Joshc | Cave (IOI13_cave) | C++11 | 563 ms | 616 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 "cave.h"
#include <vector>
using namespace std;
void exploreCave(int N) {
int guess[5000], known[5000], door[5000];
for (int i=0; i<N; i++) known[i] = -1;
for (int i=0; i<N; i++) {
vector<int> unknown;
for (int i=0; i<N; i++) {
if (known[i] != -1) guess[i] = known[i];
else guess[i] = 0, unknown.push_back(i);
}
int cur = tryCombination(guess), t=0;
if (cur == i) t = 1;
while (unknown.size() > 1) {
vector<int> a, b;
for (int i=0; i<unknown.size(); i++) {
if (i*2<unknown.size()) a.push_back(unknown[i]);
else b.push_back(unknown[i]);
}
unknown.clear();
for (int i : a) guess[i] = t;
for (int i : b) guess[i] = 1-t;
int z = tryCombination(guess);
if (z > i || z == -1) {
for (int i : a) unknown.push_back(i);
} else {
for (int i : b) unknown.push_back(i);
}
}
known[unknown[0]] = t;
door[unknown[0]] = i;
}
answer(known, door);
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |