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 <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int N) {
int config[N],perm[N];
vector<int> idx;
for(int i=0;i<N;++i) idx.push_back(i);
for(int i=0;i<N;++i) {
int on=1;
for(int x:idx) config[x]=1;
if(tryCombination(config)==i) on=0;
for(int x:idx) config[x]=!on;
int lo=0,hi=N-i-1;
while(lo<=hi) {
int mid=(lo+hi)/2,j=0;
for(int x:idx) {
if(j>mid) break;
if(j++<lo) continue;
config[x]=on;
}
if(tryCombination(config)==i) lo=mid+1;
else hi=mid-1;
for(int x:idx) config[x]=!on;
}
config[idx[lo]]=on;
perm[idx[lo]]=i;
idx.erase(idx.begin()+lo);
}
answer(config,perm);
}
# | 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... |