#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
#define lim 5005
int arr[lim],arr_use[lim];
bool kesin[lim];
inline void change(int l,int kac,int val){
int cur=l;
kac-=l;
kac++;
while(kac){
if(kesin[cur]){
cur++;
}
else{
kac--;
arr_use[cur]=val;
}
}
}
void exploreCave(int N) {
int n=N;
int ans[n],ans2[n];
for(int i=0;i<n;i++){
int door=tryCombination(arr);
if(door!=i)ans[i]=0; //cevap 0da
else ans[i]=1; // cevap 1de
int l=0,r=n-i-1;
while(l<=r){
int m=(l+r)/2;
change(l,m,ans[i]^1);
int door_use=tryCombination(arr_use);
if(door_use!=i)l=m+1;
else r=m-1;
}
ans2[i]=r;
kesin[i]=1;
arr[r]=ans[i];
for(int i=0;i<n;i++){
arr_use[i]=arr[i];
}
}
answer(ans,ans2);
return ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
133 ms |
568 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |