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;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
void exploreCave(int N){
int s[N], d[N];
memset(s, 0, sizeof(s));
vector<bool> checked(N);
for(int i = 0; i < N; i++){
int l = 0, r = N-1;
int f_ans = tryCombination(s);
while(l != r){
int temp[N];
for(int j = 0; j < N; j++)
temp[j] = s[j];
int mid = (l+r)/2;
for(int j = l; j <= mid; j++){
if(checked[j])
continue;
temp[j] = !s[j];
}
int ans = tryCombination(temp);
if((f_ans == i && ans != i) || (f_ans != i && ans == i))
r = mid;
else
l = mid+1;
}
d[l] = i;
checked[l] = 1;
if(f_ans == i)
s[l] = !s[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... |