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 <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int N){
bool lock[N] = {0};
int ans[N] = {0};
int check[N] = {0};
for(int i = 0; i < N; i ++){
for(int j = 0; j < N; j ++){
if(!lock[j]){
check[j] = 0;
}
}
int sign = 0, op;
int t = tryCombination(check);
if(t > i || t < 0){
sign = 0;
}
else{
sign = 1;
}
op = abs(sign - 1);
int l = 0, r = N;
//cout << "beg " << i << endl;
while(l + 1 < r){
int mid = (l + r+1) / 2;
for(int j = l; j < mid; j ++){
if(!lock[j])check[j]=sign;
}
for(int j = mid; j < r; j ++){
if(!lock[j])check[j]=op;
}
int a = tryCombination(check);
if(a <= i && a >= 0){
l = mid;
}
else{
r = mid;
}
}
lock[l] = true;
ans[l] = i;
check[l] = sign;
}
answer(check, ans);
}
# | 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... |