#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef tuple<ll, ll, ll> plll;
typedef vector<plll> vplll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vector<pll>> vvpll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;
#include "cave.h"
ll s[5000];
vll pos;
vb ass;
ll n;
void update(ll i,ll endi) {
for (;i<=endi ;i++) {
if (!ass[i]) s[i] = (s[i]==0?1:0);
}
}
ll bl(ll i) {
ll l = 0, r =n-1;
while (l<r) {
ll t = tryCombination(s);
ll mid = (r+l)/2;
update(l,mid);
ll t1 = tryCombination(s);
if (t!= t1) {
r = mid;
}
else l = mid+1;
}
ass[i] = 1;
pos[i] = l;
return l;
}
void exploreCave(int N) {
n= N;
pos.resize(n);
ass.resize(n);
loop(i,0,n) {
ll c= bl(i);
if (tryCombination(s)==c) s[i] = (s[i]==0?1:0);
}
ll posi[n];
loop(i,0,n) posi[i] = pos[i];
answer(s, posi);
}
# | 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... |