이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave (int N) {
int known[N], correctSw[N];
for (int i = 0; i < N; i++)
known[i] = -1;
for (int i = 0; i < N; i++) {
int segLen = pow(2, __lg(N - i - 1));
int output[N];
for (int i = 0; i < N; i++)
output[i] = known[i];
int c = 0, pos = 0;
for (int j = 0; j < N; j++) {
if (output[j] == -1)
output[j] = 0;
}
bool doorSw = 0;
if (tryCombination(output) > i)
doorSw = 0;
else
doorSw = 1;
while (1) {
for (int j = 0; j < N; j++) {
if (output[j] == -1) {
output[j] = ((c / segLen + doorSw) % 2);
c++;
}
}
if (!(tryCombination(output) > i))
pos = pos | (1 << __lg(segLen));
if (segLen == 1)
break;
segLen /= 2;
}
int k = 0;
for (int j = 0; j < N; j++) {
if (known[j] == -1) {
if (k == pos) {
known[j] = doorSw;
correctSw[doorSw] = i;
break;
}
k++;
}
}
}
answer(known, correctSw);
}
# | 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... |