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 n, a[5100], b[5100];
bool used[5100];
void xr(int l, int r){
for (int i = l; i <= r; i++)
if (!used[i])
a[i] ^= 1;
}
void open(int i){
int num = tryCombination(a);
int need = ((num > i || num == -1) ? 1 : 0);
int l = 0, r = n-1;
while (l < r){
int mid = (l+r)>>1;
xr(l, mid);
int num = tryCombination(a);
int cur = ((num > i || num == -1) ? 1 : 0);
xr(l, mid);
if (cur == need)
l = mid+1; else
r = mid;
}
a[l] = need^1;
b[l] = i;
used[l] = 1;
}
void exploreCave(int N) {
n = N;
for (int i = 0; i < n; i++){
open(i);
}
answer(a, b);
}
# | 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... |