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;
void exploreCave(int n) {
int s[n], d[n], comb[n];
vector<int> switches;
for (int i=0; i<n; i++) switches.push_back(i);
for (int door=0; door<n; door++){
for (int i: switches) comb[i]=0;
if (tryCombination(comb)==door){
for (int i: switches) comb[i]=1;
}
int l=0, r=switches.size()-1, mid;
while (l<r){
mid=(l+r)/2;
for (int i=mid+1; i<=r; i++) comb[switches[i]]=1-comb[switches[i]];
if (tryCombination(comb)==door){
for (int i=mid+1; i<=r; i++) comb[switches[i]]=1-comb[switches[i]];
l=mid+1;
}else{
r=mid;
}
}
s[switches[l]]=comb[switches[l]];
d[switches[l]]=door;
switches.erase(switches.begin()+l);
}
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... |