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 NN 5005
void exploreCave(int n) {
static int s2d[NN], isknown[NN], correct[NN];
for (int i = 0; i < n; ++i)
isknown[i] = 0;
for (int i = 0; i < n; ++i)
{
static int s[NN];
for (int j = 0; j < n; ++j)
{
s[j] = 0;
if (isknown[j])
s[j] = correct[j];
}
int first, correct_;
first = tryCombination(s);
if (first == -1 || first > i)
correct_ = 0;
else
correct_ = 1;
int lower = -1, upper = n;
while (upper - lower > 1)
{
int mid = lower+(upper-lower)/2;
for (int j = 0; j < n; ++j)
{
if (isknown[j])
continue;
if (j <= mid)
s[j] = correct_;
else
s[j] = correct_^1;
}
int first = tryCombination(s);
if (first == -1 || first > i)
upper = mid;
else
lower = mid;
}
int sw = upper;
s2d[sw] = i;
isknown[sw] = 1;
//known[ko++] = sw;
correct[sw] = correct_;
}
answer(correct, s2d);
/* ... */
}
# | 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... |