#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int N) {
int trial[N];
int determined[N];
int switches[N];
for (int i=0; i<N; i++) {
determined[i] = -1;
switches[i] = -1;
}
for (int i=0; i<N; i++) {
for (int j=0; j<N; j++) {
if (determined[j] == 1) {
trial[j] = 1;
} else {
trial[j] = 0;
}
}
bool res = (tryCombination(trial) == i);
int bitres = 0;
for (int k=0; k<13; k++) {
for (int l=0; l<N; l++) {
if (determined[l] != -1) {
trial[l] = determined[l];
} else {
trial[l] = ((1 << k) & l) >> k;
}
}
bool resk = (tryCombination(trial) == i);
if (resk != res) {
bitres ^= (1 << k);
}
}
determined[bitres] = res ? 1 : 0;
switches[bitres] = i;
}
answer(determined, switches);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |