#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int N) {
int a[N];
int b[N];
for (int i = 0; i < N; i++)a[i] = 0;
for (int i = 0; i < N; i++)b[i] = 0;
vector<bool> chkpnel(N, 0);
int x;
for (int i = 0; i < N; i++) {
int ina = 0, inb = N - 1, ans = N - 1;
x = tryCombination(a);
if (x == i) {
for (int j = 0; j < N; j++) {
if (chkpnel[j])continue;
a[j] ^= 1;
}
}
while (ina <= inb) {
int mid = (ina + inb) >> 1;
for (int j = 0; j < mid; j++) {
if (chkpnel[j])continue;
a[j] ^= 1;
}
x = tryCombination(a);
for (int j = 0; j < mid; j++) {
if (chkpnel[j])continue;
a[j] ^= 1;
}
if (x == i) {
ans = mid;
inb = mid - 1;
} else {
ina = mid + 1;
}
}
b[ans] = i;
chkpnel[ans] = 1;
}
answer(a, b);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
301 ms |
596 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
503 ms |
592 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Answer is wrong |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Answer is wrong |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
301 ms |
596 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |