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"
#define endline "\n"
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define lsb(i) i&(-i)
#define sz(i) (int)i.size()
typedef long long ll;
using namespace std;
const ll INF = 1e18L;
constexpr int mod = int(1e9) + 7;
ll t=1, n, k, cases = 0;
void exploreCave(int n){
int check[n],door[n];
for(int i = 0; i < n; i++)check[i] = -1;
for(int i = 0; i < n; i++){
int comb[n] = {};
for(int i = 0; i < n; i++){
if(check[i] != -1)comb[i] = check[i];
}
int cur;
if(tryCombination(comb) > i)cur = 0;
else cur = 1;
int l = 1, r = n + 1;
while(r - l > 1){
int m = (r + l) / 2;
for(int i = 0; i < n; i++){
if(check[i] != -1)comb[i] = check[i];
else if(i >= l and i <= m)comb[i] = cur;
else comb[i] = cur ^ 1;
}
if(tryCombination(comb) > i)r = m;
else l = m;
}
check[l] = cur;
door[l] = i;
}
answer(check, door);
}
# | 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... |