이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int N) {
int guess[N] = {}, ans[N] = {}, order[N] = {}, fixed[N] = {};
for (int i = 0; i < N; i++) ans[i] = -1, order[i] = -1, fixed[i] = 0;
for (int i = 0; i < N; i++) {
int le = 0, ri = N - 1;
int sv = N - 1;
for (int j = 0; j < N; j++) guess[j] = ans[j];
for (int j = 0; j < N; j++) if (fixed[j] != 1) guess[j] = 1;
int type = tryCombination(guess);
if (type == -1) type = N;
type = (type > i)? 1 : 0;
while (le <= ri) {
int mid = (le + ri) / 2;
for (int j = 0; j < N; j++) {
if (fixed[j] == 1) {
guess[j] = ans[j];
} else if (j <= mid) {
guess[j] = type;
} else {
guess[j] = type ^ 1;
}
}
int check = tryCombination(guess);
if (check == -1) check = N;
if (check > i) {
sv = mid;
ri = mid - 1;
} else {
le = mid + 1;
}
}
order[sv] = i;
fixed[sv] = 1;
ans[sv] = type;
}
answer(ans, order);
}
# | 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... |