# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
317334 |
2020-10-29T14:08:22 Z |
Sho10 |
Cave (IOI13_cave) |
C++14 |
|
0 ms |
0 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#include "cave.h"
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int n,pos[5005],ans[5005],x[5005],s1,s2;
ll check(ll val,ll l,ll r){
for(ll i=l;i<=r;i++)
{
if(x[i]==0){
ans[i]^=1;
}
}
s1=s2;
s2=tryCombination(ans);
if(s2==-1){
s2=n;
}
if(s1==val&&s2==val){
return 0;
}else if(s1==val||s2==val){
return 1;
}else return 0;
}
void exploreCave(int N){
n=n;
for(;i<=n;i++)
{
ll l=0,r=n-1;
s2=trycombination(ans);
if(s2==-1){
s2=n;
}
while(l<r){
ll mid=(l+r)/2;
if(check(i,l,mid)){
r=mid;
}else l=mid+1;
}
if(s2==i){
ans[l]^=1;
}
pos[l]=i;
x[l]=1;
}
answer(ans,pos);
}
/*
int32_t main(){
CODE_START;
*/
Compilation message
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:43:6: error: 'i' was not declared in this scope
43 | for(;i<=n;i++)
| ^
cave.cpp:46:8: error: 'trycombination' was not declared in this scope; did you mean 'tryCombination'?
46 | s2=trycombination(ans);
| ^~~~~~~~~~~~~~
| tryCombination