#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef pair<char, int> ci;
typedef pair<string, int> si;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
#define pb push_back
#define sz(a) ((int)a.size())
#define fi first
#define se second
#define whole(v) v.begin(), v.end()
#define rwhole(v) v.rbegin(), v.rend()
#define inf INT_MAX/2
#define fro front
#define pqueue priority_queue
#define llpc(x) __builtin_popcountll(x)
#define ipc(x) __builtin_popcount(x)
#define iclz(x) __builtin_clz(x)
#define llclz(x) __builtin_clzll(x)
#define ictz(x) __builtin_ctz(x)
#define llctz(x) __builtin_ctzll(x)
void exploreCave(int N) {
int n = n;
int ud[n], ans[n];
memset(ud, -1, sizeof ud);
memset(ans, -1, sizeof ans);
for(int i = 0; i < n; ++i){
int ask[n];
for(int j = 0; j < n; ++j){
ask[j] = ud[j];
if(ask[j] == -1){
ask[j] = 0;
}
}
int res = tryCombination(ask);
int o = 0;
if(res <= i){
o = 1;
}
int lo = -1;
int hi = n;
//cout << i << " " << o << endl;
while(hi - lo > 1){
int mid = lo + (hi - lo) / 2;
for(int j = 0; j < n; ++j){
ask[j] = ud[j];
if(ask[j] == -1){
ask[j] = abs(o - 1);
}
}
for(int j = 0; j <= mid; ++j){
ask[j] = ud[j];
if(ask[j] == -1){
ask[j] = o;
}
}
int res = tryCombination(ask);
if(res <= i && res > -1){
lo = mid;
}else{
hi = mid;
}
}
ud[i] = o;
ans[hi] = i;
}
answer(ud, 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... |