# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1174868 | trvhung | Cave (IOI13_cave) | C++20 | 171 ms | 508 KiB |
#include "cave.h"
void exploreCave(int N) {
int sw[N], fx[N], ofSw[N];
for (int i = 0; i < N; ++i)
fx[i] = -1;
for (int d = 0; d < N; ++d) {
for (int i = 0; i < N; ++i)
sw[i] = fx[i] == -1 ? 0 : fx[i];
int cur = (tryCombination(sw) == d);
int l = 0, r = N - 1;
while (l != r) {
int mid = (l + r) >> 1;
for (int i = l; i <= mid; ++i)
sw[i] = fx[i] == -1 ? 1 : fx[i];
int ask = (tryCombination(sw) == d);
for (int i = l; i <= mid; ++i)
sw[i] = fx[i] == -1 ? 0 : fx[i];
if (ask == cur)
l = mid + 1;
else
r = mid;
}
fx[l] = cur;
ofSw[l] = d;
# | 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... |