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[5010], d[5010], n;
bool mk[5010];
void change(int lo, int hi)
{
int m = (lo + hi)/2;
for(int i = lo; i <= m;i++)
if(!mk[i])
s[i] ^= 1;
}
void exploreCave(int N) {
n = N;
for(int i = 0; i < N; i++)
{
int lo = 0, hi = n-1;
int ps = tryCombination(s);
int open = i < ps || ps == -1 ? 0 : 1;
int after;
while(lo != hi)
{
int m = (lo + hi) / 2;
change(lo,hi);
int pos = tryCombination(s);
after = i < pos || pos == -1 ? 0 : 1;
change(lo,hi);
if(open != after)
hi = m;
else
lo = m+1;
}
mk[lo] = true;
s[lo] = open;
d[lo] = i;
}
answer(s,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... |