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 <bits/stdc++.h>
using namespace std;
void exploreCave(int N) {
int S[N] = {0};
int D[N] = {0};
vector<int> left;
for (int i = 0; i < N; ++i) left.push_back(i);
for (int i = 0; i < N; ++i) {
for (int x : left) {
S[x] = 1;
}
int cp = 0;
int ans = tryCombination(S);
if (ans == -1) ans = 1e9;
if (ans > i) cp = 1;
vector<int> pos = left;
vector<int> a, b;
while (pos.size() > 1) {
for (int x : pos) {
if (a.size() < b.size()) a.push_back(x);
else b.push_back(x);
}
for (int x : a) S[x] = cp;
for (int x : b) S[x] = 1 - cp;
int ans = tryCombination(S);
if (ans == -1) ans = 1e9;
if (ans > i) pos = a;
}
D[pos[0]] = i;
S[pos[0]] = cp;
left.erase(find(left.begin(), left.end(), pos[0]));
}
answer(S, D);
}
# | 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... |