이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
int S[5000], A[5009], B[5009], col[5009];
void exploreCave(int N) {
for (int i = 0; i < N; i++) col[i] = -1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (col[j] == -1) S[j] = 0;
else S[j] = col[j];
}
int Z = tryCombination(S);
int L = 0, R = N, M, res = 0;
while (R - L >= 2) {
M = (L + R) / 2;
for (int j = 0; j < N; j++) {
if (col[j] == -1) { if (L <= j && j < M) S[j] = 1; else S[j] = 0; }
else S[j] = col[j];
}
int ZZ = tryCombination(S);
bool ok1 = true; if (Z == i) ok1 = false;
bool ok2 = true; if (ZZ == i) ok2 = false;
if (ok1 != ok2) { res = L; R = M; }
if (ok1 == ok2) { res = M; L = M; }
}
if (Z == i) {
// This switch should be 1.
col[res] = 1; A[res] = i; B[res] = 1;
}
else {
// THis switch should be 0.
col[res] = 0; A[res] = i; B[res] = 0;
}
}
answer(B, A);
}
# | 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... |