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"
const int maxn = 5e3+5;
int pos[maxn], val[maxn];
int A[maxn];
int tryCombination(int S[]);
void answer(int S[], int D[]);
void exploreCave(int N);
void exploreCave(int N) {
for(int i = 0; i < N; i++)val[i] = -1;
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
if(val[j] != -1)A[j] = val[j];
else A[j] = 0;
}
int nw = tryCombination(A) == i, p = 0;
for(int d = 0; (1<<d) < N; d++){
for(int j = 0; j < N; j++){
if(val[j] != -1)continue;
A[j] = nw^((j>>d)&1);
}
if(tryCombination(A) == i)p^=(1<<d);
}
val[p] = nw;
pos[p] = i;
}
answer(val, pos);
}
# | 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... |