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"
int marc[5123];
int n, R[5123], ans[5123];
void flip(int i, int j){
for(; i <= j; i++)
if(!marc[i])
R[i] = !R[i];
}
void BB(int i){
int ini, fim, mid, ir, is, ip;
ir = tryCombination( R);
if(ir > i || ir == -1)
is = 0;
else
is = 1;
ini = 0; fim = n -1;
while(ini != fim){
mid = (ini + fim)/2;
flip(ini, mid);
ir = tryCombination(R);
if(ir > i || ir == -1)
ip = 0;
else
ip = 1;
flip(ini, mid);
if(is != ip)
fim = mid;
else
ini = mid + 1;
}
ans[ini] = i;
R[ini] = is;
marc[ini] = 1;
}
void exploreCave(int N) {
n = N;
for(int i = 0; i < n; i++)
BB(i);
answer( R, ans);
}
# | 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... |