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;
const int MAXN = 5010;
int S[MAXN];
int D[MAXN];
bool ok[MAXN];
void exploreCave(int N) {
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++)
if(!ok[j])
S[j] = 0;
int ans = tryCombination(S);
if(ans == i)
for(int j = 0; j < N; j++)
if(!ok[j])
S[j] = 1;
int l = 0, r = N - 1;
while(l < r){
int mid = (l + r) >> 1;
for(int j = l; j <= mid; j++)
if(!ok[j])
S[j] = 1 - S[j];
ans = tryCombination(S);
for(int j = l; j <= mid; j++)
if(!ok[j])
S[j] = 1 - S[j];
if(ans == i)
r = mid;
else l = mid + 1;
}
ok[l] = 1;
D[l] = i;
// cout << l << endl;
}
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... |