이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <algorithm>
using namespace std;
void exploreCave(int N) {
int right[N];
fill(right, right + N, 0);
int match[N];
for (int i = 0; i < N; ++i) {
int S[N];
int l = -1, r = N - 1;
fill(S, S + N, 0);
for (int j = 0; j < i; ++j) {
S[match[j]] = right[match[j]];
}
int my = 0;
if (tryCombination(S) == i) {
my = 1;
}
while (l + 1 < r) {
int m = (l + r) / 2;
fill(S, S + N, my ^ 1);
for (int j = 0; j <= m; ++j) {
S[j] ^= 1;
}
for (int j = 0; j < i; ++j) {
S[match[j]] = right[match[j]];
}
if (tryCombination(S) == i) {
l = m;
} else {
r = m;
}
}
match[i] = r;
right[r] = my;
}
int revmatch[N];
for (int i = 0; i < N; ++i) {
revmatch[match[i]] = i;
}
answer(right, revmatch);
}
| # | 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... |