# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
571992 | Vanilla | Cave (IOI13_cave) | C++17 | 84 ms | 404 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 s[n], dr[n];
for (int i = 0; i < n; i++){
s[i] = 0, dr[i] = -1;
}
for (int door = 0; door < n; door++){
for (int i = 0; i < n; i++){
if (dr[i] == -1) {
s[i] = 0;
}
}
int l = 0, r = n-1, state = 1, k = tryCombination(s);
int rs = 0;
while (l <= r) {
for (int i = l; i <= r; i++){
if (dr[i] == -1) s[i] = 0;
}
int mid = (l + r) / 2;
for (int i = l; i <= mid; i++){
if (dr[i] == -1) dr[i] = 1;
}
k = tryCombination(s);
if(k == door) {
r = mid;
state = !state;
}else {
l = mid + 1;
}
}
dr[l] = door;
s[l] = state;
}
answer(s, dr);
}
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... |