#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])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 ;
pos[l] = i ;
}
answer(arr , pos);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
313 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
608 ms |
512 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
313 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |