# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730309 | Desh03 | 동굴 (IOI13_cave) | C++17 | 348 ms | 392 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int n) {
int v[n], d[n];
for (int i = 0; i < n; i++) v[i] = d[i] = -1;
int f = 0;
while (f != n) {
int l = 0, r = n - 1;
int s[n];
for (int i = 0; i < n; i++) {
if (d[i] != -1) s[i] = v[i];
else s[i] = 0;
}
int x = tryCombination(s), to_check;
if (x == f) to_check = 0;
else to_check = 1;
for (int i = 0; i < n; i++)
if (d[i] != -1) s[i] = to_check;
while (l < r) {
int m = l + r >> 1;
for (int i = l; i <= m; i++)
if (d[i] != -1) s[i] ^= 1;
x = tryCombination(s);
if (x != f) {
for (int i = l; i <= m; i++)
if (d[i] != -1) s[i] ^= 1;
r = m;
} else l = m + 1;
}
v[l] = to_check, d[l] = f++;
}
answer(v, d);
}
Compilation message (stderr)
# | 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... |