This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#define MAXN 5005
void exploreCave(int N) {
int S[MAXN], D[MAXN], B=12; //correct orientation of switch, connection of switch
bool done[MAXN]={};
for (int i=0; i<N; i++) {
int ask[MAXN], mask=0, type = 0;
for (int j=0; j<N; j++) {
if (done[j]) {ask[j]=S[j];}
else {ask[j]=0;}
}
if (tryCombination(ask) == i) {
type = 1; //correct setting is 1 for next door
}
for (int j=0; j<=B; j++) {
for (int k=0; k<N; k++) {
if (!done[k]) {ask[k] = (k&(1<<j)) > 0;}
}
if (tryCombination(ask) != i) {
mask += (1<<j);
}
}
if (type == 1) {
S[mask] = 1, D[mask] = i, done[mask] = true;
} else {
S[(2<<B)-1-mask] = 0, D[(2<<B)-1-mask] = i, done[(2<<B)-1-mask] = true;
}
}
answer(S, D);
}
# | 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... |