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) {
vector<int> state(N), connect(N, N);
for (int i=0; i<N; i++) {
vector<int> guess(N);
for (int j=0; j<N; j++) {
if (connect[j] < i)
guess[j] = state[j];
}
bool x = tryCombination(&guess[0]) == i;
int l = 0, r = N;
while (l < r) {
int m = (l + r) / 2;
for (int j=0; j<N; j++) {
if (connect[j] < i)
guess[j] = state[j];
else if (j < l || j >= r)
guess[j] = 0;
else
guess[j] = j <= m;
}
bool y = tryCombination(&guess[0]) == i;
if (x == y)
l = m + 1;
else
r = m;
}
state[l] = x;
connect[l] = i;
}
answer(&state[0], &connect[0]);
}
# | 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... |