#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int N) {
int S[N];
int D[N];
bool ok[N];
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++)
if(!ok[j])
S[j] = 0;
int ans = tryCombination(S);
if(ans == i)
for(int j = 0; j < N; j++)
if(!ok[j])
S[j] = 1;
int l = 0, r = N - 1;
while(l < r){
int mid = (l + r) >> 1;
for(int j = l; j <= mid; j++)
if(!ok[j])
S[j] = 1 - S[j];
ans = tryCombination(S);
for(int j = l; j <= mid; j++)
if(!ok[j])
S[j] = 1 - S[j];
if(ans == i)
r = mid;
else l = mid + 1;
}
ok[l] = 1;
D[l] = i;
}
answer(S, D);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
96 ms |
348 KB |
Output is correct |
2 |
Correct |
116 ms |
348 KB |
Output is correct |
3 |
Correct |
196 ms |
348 KB |
Output is correct |
4 |
Correct |
123 ms |
500 KB |
Output is correct |
5 |
Correct |
187 ms |
344 KB |
Output is correct |
6 |
Correct |
159 ms |
508 KB |
Output is correct |
7 |
Correct |
210 ms |
344 KB |
Output is correct |
8 |
Incorrect |
0 ms |
344 KB |
Answer is wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
186 ms |
504 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Answer is wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
96 ms |
348 KB |
Output is correct |
2 |
Correct |
116 ms |
348 KB |
Output is correct |
3 |
Correct |
196 ms |
348 KB |
Output is correct |
4 |
Correct |
123 ms |
500 KB |
Output is correct |
5 |
Correct |
187 ms |
344 KB |
Output is correct |
6 |
Correct |
159 ms |
508 KB |
Output is correct |
7 |
Correct |
210 ms |
344 KB |
Output is correct |
8 |
Incorrect |
0 ms |
344 KB |
Answer is wrong |
9 |
Halted |
0 ms |
0 KB |
- |