이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |