# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
305873 |
2020-09-24T04:01:48 Z |
juggernaut |
Cave (IOI13_cave) |
C++14 |
|
0 ms |
0 KB |
#include"cave.h"
#include<bits/stdc++.h>
using namespace std;
int pos[5000],n,tmp[5000],bl[5000],ans[5000],pr;
bool check(int val,int l,int r){
for(int i=l;i<=r;i++)if(!bl[i])ans[i]^=1;
int ret=tryCombination(tmp);
l=pr;
pr=ret;
return (l>=i)^(ret>=i);
}
void exploreCave(int N){
int i=0,l,r,m;
n=N;
for(;i<n;i++){
l=0,r=n-1;
pr=tryCombination(ans);
while(l<r){
m=(l+r)>>1;
if(check(i,l,m))r=m;
else l=m+1;
}
if(pr>=i)ans[l]^=1;
pos[l]=i;
bl[l]=1;
}
answer(ans,pos);
}
Compilation message
cave.cpp: In function 'bool check(int, int, int)':
cave.cpp:10:16: error: 'i' was not declared in this scope
10 | return (l>=i)^(ret>=i);
| ^