# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
992936 | vjudge1 | Cave (IOI13_cave) | C++17 | 0 ms | 0 KiB |
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;
// #define int long long
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define all(a) a.begin(),a.end()
const int NN=1e6+50000;
const int MOD=1e9+7;
const int off=(1<<11);
#define ask(x) tryCombination(x);
void exploreCave(int N){
int S[N]={},D[N]={},done[N]={};
for(int i=0;i<N;i++){
int x=ask(S);
if(x<=i)x=1;
else x=0;
int l=i,r=N-1;
while(l<r){
int md=(l+r)/2;
for(int j=l;j<=md;j++){
if(done[j])continue;
S[j]=1;
}
for(int j=md+1;j<=r;j++){
if(done[j])continue;
S[j]=0;
}
int cur=ask(S);
if(x==1){
if(cur>i){
r=md;
}
else{
l=md+1;
}
}
else{
if(cur>i){
l=md+1;
}
else{
r=md;
}
}
}
D[l]=i;
S[l]=x;
done[l]=1;
}
answer(SS,D);
}
// signed main(){
// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// }