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>
int n;
int uz[5005];
bool kay[5005];
int s[5005], d[5005];
void soli(int l, int r){
for (int i = l; i <= r; i++) if(!kay[i]) uz[i] = !uz[i];
}
void exploreCave(int N) {
n = N;
memset(uz, 0, sizeof uz);
for (int i = 0; i < n; i++){
if(tryCombination(uz) == i) soli(0, n - 1);
int l = 0, r = n - 1;
while (l != r){
int mid = (l + r) >> 1;
soli(l, mid);
int tmp = tryCombination(uz);
soli(l, mid);
if(tmp == i){ //zuun tald
r = mid;
}
else{ //baruun tald
l = mid + 1;
}
}
d[i] = l;
s[l] = uz[l];
kay[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... |