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 <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
#include "cave.h"
void exploreCave(int n) {
int a[5000] = {};
int b[5000] = {};
vector<int> c;
for (int i = 0; i < n; i++) {
c.emplace_back(i);
}
for (int i = 0; i < n; i++) {
for (int j : c) {
a[j] = 0;
}
int k = 0;
if (tryCombination(a) != i) {
k = 1;
}
int lo = 0;
int hi = n - i;
while (hi - lo > 1) {
int mid = (hi + lo) / 2;
for (int j = 0; j < n - i; j++) {
if (j < mid) {
a[c[j]] = k;
} else {
a[c[j]] = k ^ 1;
}
}
if (tryCombination(a) == i) {
hi = mid;
} else {
lo = mid;
}
}
a[c[lo]] = k ^ 1;
b[c[lo]] = i;
c.erase(c.begin() + lo);
}
assert(tryCombination(a) == -1);
answer(a, b);
}
# | 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... |