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"
#include <bits/stdc++.h>
const int maxn = 5050;
int S[maxn], D[maxn];
int switched[maxn];
void exploreCave(int N) {
for(int i = 0; i < N; i++) {
int comb = (tryCombination(S) != i);
int L = 0, R = N - 1;
while(L < R) {
int mid = (L + R) / 2;
for(int j = L; j <= mid; j++) {
if(!switched[j]) {
S[j] = 1 - S[j];
}
}
int comb2 = (tryCombination(S) != i);
for(int j = L; j <= mid; j++) {
if(!switched[j]) {
S[j] = 1 - S[j];
}
}
if(comb == comb2) {
L = mid + 1;
}
else {
R = mid;
}
}
D[L] = i;
if(comb == 0) {
S[i] = 1 - S[i];
}
switched[L] = 1;
}
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... |