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;
while (l < r-1) {
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;
} else {
l = m;
}
}
pos[l] = correct_pos;
door[l] = d;
}
answer(pos, door);
}
# | 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... |