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>
#include "cave.h"
using namespace std;
void exploreCave(int n){
int door[n], move[n], use[n] = {};
for (int i = 0; i < n; i++){
int low = 0, high = n, A[n] = {}, openSt = 1;
memcpy(A, move, sizeof(move));
auto setA = [&](int l, int r){
for (int j = 0; j < n; j++)
if (!use[j])
A[j] = (j >= l and j <= r) ? openSt ^ 1 : openSt;
return tryCombination(A) == i;
};
openSt = setA(0, n - 1);
while (low < high){
int mid = (low + high) / 2;
setA(low, mid) ? high = mid : low = mid + 1;
}
door[low] = i; move[low] = openSt; use[low] = 1;
}
answer(move, door);
}
# | 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... |