## Submission #167439

# Submission time Handle Problem Language Result Execution time Memory
167439 2019-12-08T14:54:16 Z wildturtle Cave (IOI13_cave) C++14
Compilation error
0 ms 0 KB
```#include"cave.h"
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,i,e,f,g,n,m,k,l,A[200005],B[200005],C[200005],D[200005],mid,le,ri;
void go(int x,int y) {
for(int i=0;i<N;i++) {
if(B[i]>0) A[i]=B[i]-1;
else { if(x<=i && i<=y) A[i]=1;
else A[i]=0;
}
}
return tryCombination(A);
}
void go1(int x,int y) {
for(int i=0;i<N;i++) {
if(B[i]>0) A[i]=B[i]-1;
else { if(x>i || i>y) A[i]=0;
else A[i]=1;
}
}
return tryCombination(A);
}
void exploreCave(int N) {
for(int i=0;i<N;i++) {
le=0; ri=N-1;
a=0;
c=go(0,N-1);
if(c>i || c==-1) a=1;
while(le<=ri) {
mid=(le+ri)/2;
if(a==1) {
c=go(le,mid);
if(c>i || c==-1) b=mid;
else a=mid+1;
}
else {
c=go1(le,mid);
if(c>i || c==-1) b=mid;
else a=mid+1;
}
}
if(c==1) B[i]=2;
else B[i]=1;
C[i]=c;
D[i]=mid;
}
}```

### Compilation message

```cave.cpp: In function 'void go(int, int)':
cave.cpp:6:26: error: 'N' was not declared in this scope
for(int i=0;i<N;i++) {
^
cave.cpp:12:35: error: return-statement with a value, in function returning 'void' [-fpermissive]
return tryCombination(A);
^
cave.cpp: In function 'void go1(int, int)':
cave.cpp:15:26: error: 'N' was not declared in this scope
for(int i=0;i<N;i++) {
^
cave.cpp:21:35: error: return-statement with a value, in function returning 'void' [-fpermissive]
return tryCombination(A);
^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:27:33: error: void value not ignored as it ought to be
c=go(0,N-1);
^
cave.cpp:32:56: error: void value not ignored as it ought to be
c=go(le,mid);
^
cave.cpp:37:57: error: void value not ignored as it ought to be
c=go1(le,mid);
^```