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 <string.h>
#include "cave.h"
int n, s[5001], d[5001], a[5001], b[5001];
void exploreCave(int N) {
memset(d, -1, sizeof(d));
n = N;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (d[j] >= 0) s[j] = d[j];
else s[j] = 0;
}
int w = tryCombination(s);
int lo = 0, hi = n;
while (lo + 1 < hi) {
int mid = (lo + hi) / 2;
for (int j = 0; j < n; j++) {
if (d[j] >= 0) s[j] = d[j];
else {
if (j < mid) s[j] = 1;
else s[j] = 0;
}
}
int y = tryCombination(s);
if (w == i) {
if (w != y) hi = mid;
else lo = mid;
}
else {
if (y == i) hi = mid;
else lo = mid;
}
}
a[lo] = i;
d[lo] = (w == i ? 1 : 0);
}
answer(a, 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... |