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"
#define MAXN 5000
#define LOGN 12
int s[MAXN], d[MAXN];
bool done[MAXN];
inline bool vezi(int a, bool k, int u, int n) {
for (int i = 0; i <= a; i++)
if (done[i] == 0)
s[i] = k;
for (int i = a + 1; i < n; i++)
if (done[i] == 0)
s[i] = 1 - k;
bool ans = tryCombination(s) == u;
for (int i = 0; i < n; i++)
if (done[i] == 0)
s[i] = 0;
return ans;
}
void exploreCave(int n) {
for (int i = 0; i < n; i++) {
bool k = tryCombination(s) == i;
int rez = -1;
for (int pas = 1 << LOGN; pas; pas >>= 1)
if (rez + pas < n - 1 && vezi(rez + pas, k, i, n))
rez += pas;
rez++;
d[rez] = i;
s[rez] = k;
done[rez] = 1;
}
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... |