#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int N) {
int S[N],D[N];
for(int i = 0; i < N; i++) {
S[i] = 0;
D[i] = -1;
}
for(int Q = 0; Q < N; Q++) {
int X = tryCombination(S);
int l = 0, r = N - 1,ans = -1,yy;
while(l <= r) {
int mid = (l + r) / 2;
for(int i = l; i <= mid; i++) if(D[i] == -1) S[i] ^= 1;
int Y = tryCombination(S);
yy = Y;
for(int i = l; i <= mid; i++) if(D[i] == -1) S[i] ^= 1;
if(X != Y) {
ans = mid;
r = mid - 1;
}else {
l = mid + 1;
}
}
assert(ans != -1);
D[ans] = X;
S[ans] ^= 1;
if(X == -1) {
D[ans] = yy;
S[ans] ^= 1;
}
else if(yy < X && yy != -1) {
D[ans] = yy;
S[ans] ^= 1;
}
}
answer(S,D);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
47 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Answer is wrong |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Answer is wrong |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |