# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988728 | Ariadna | Cave (IOI13_cave) | C++14 | 2 ms | 604 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;
int s[5000];
int pos[5000];
int door[5000];
void exploreCave(int N) {
for (int d = 0; d < N; ++d) {
int correct_pos = 0;
for (int i = 0; i < N; ++i)
if (pos[i] != -1) s[i] = pos[i];
else s[i] = 0;
if (tryCombination(s) == d) correct_pos = 1;
int l = 0, r = N-1, ans;
while (l <= r) {
int m = (l+r)/2;
for (int i = 0; i < N; ++i) {
if (pos[i] != -1) s[i] = pos[i];
else if (i < m) s[i] = correct_pos;
else s[i] = 1-correct_pos;
}
int res = tryCombination(s);
if (res > d || res == -1) {
r = m-1;
} else {
ans = m;
l = m+1;
}
}
pos[ans] = correct_pos;
door[ans] = d;
}
answer(pos, door);
}
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... |