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;
const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;
bool mark[MAX];
void exploreCave(int n){
int S[n] = { 0 }, D[n] = { 0 };
for(int door = 0; door < n; door++){
for(int i = 0; i < n; i++)
if(!mark[i]) S[i] = 0;
int color = (tryCombination(S) == door);
int l = 0, r = n - 1;
while(l < r){
ll m = (l + r) >> 1;
for(int i = l; i < m; i++) if(!mark[i]) S[i] = color;
for(int i = m; i <= r; i++) if(!mark[i]) S[i] = !color;
int query = tryCombination(S);
if(query == door) l = m;
else r = m - 1;
}
mark[l] = true;
D[l] = door;
S[l] = color;
}
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... |