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];
memset(S, 0, sizeof(S));
vector<int> switches(N);
for (int i = 0; i < N; i++)
{
switches[i] = i;
}
int ans[N];
for (int i = 0; i < N; i++)
{
for(int a:switches){
S[a] = 0;
}
if(tryCombination(S) != i){
for(int a:switches){
S[a] = 1;
}
}
int l = 0, r = switches.size() - 1;
while(l < r){
int mid = (l + r) / 2;
for(int j = l; j <= mid; j++){
S[switches[j]] ^= 1;
}
int t = tryCombination(S);
for(int j = l; j <= mid; j++){
S[switches[j]] ^= 1;
}
if(t != i)
r = mid;
else
l = mid + 1;
}
S[switches[l]] ^= 1;
ans[switches[l]] = i;
switches.erase(switches.begin() + l);
}
answer(S, 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... |