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 ;
void exploreCave(int N) {
int constant[N] , arr[N] , pos[N];
memset(constant , 0 , sizeof constant);
for(int i = 0 ; i < N ; i ++)
arr[i] = i % 2 ;
for(int i = 0 ; i < N ; i ++){
int ret = tryCombination(arr);
if(ret != i){
for(int j = 0 ; j < N ; j ++){
if(constant[j])continue ;
arr[j] = (arr[j] + 1 ) % 2 ;
}
}
int l = 0 , r = N - 1 , md ;
while(l < r){
md = (l + r) / 2 ;
int check[N];
for(int j = 0 ; j < N ; j ++){
if(constant[j]){
check[j] = arr[j];
continue ;
}
check[j] = (j >= l && j <= md ? arr[j] : arr[j] ^ 1);
}
ret = tryCombination(check);
if(ret == i)r = md ;
else l = md + 1 ;
}
constant[l] = 1 ;
arr[l] ^= 1 ;
pos[l] = i ;
}
answer(arr , pos);
}
# | 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... |