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>
using namespace std;
/*
int tryCombination(int S[]);
void answer(int S[], int D[]);
void exploreCave(int N);
*/
void exploreCave(int N) {
int d[N]={},s[N]={};
bool dn[N]={};
int ts=tryCombination(s),ts2;
for(int i=0; i<N; i++){
int l=0,r=N-1;
while(l<=r){
if(l==r){
dn[l]=1;
d[l]=i;
if(ts<=i)s[l]^=1;
break;
}
int md=(l+r)/2;
for(int j=l; j<=md; j++){
if(dn[j])continue;
s[j]^=1;
}
ts2=tryCombination(s);
if((ts<=i && ts2>=i+1) || (ts>=i+1 && ts2<=i)){
r=md;
ts=ts2;
}
else{
l=md+1;
}
for(int j=l; j<=md; j++){
if(dn[j])continue;
s[j]^=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... |