Submission #544155

#TimeUsernameProblemLanguageResultExecution timeMemory
544155krit3379Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #include"cave.h" #define N 5005 int s[n],ans[N]; void exploreCave(int n){ int n; for(i=0;i<n;i++)ans[i]=-1; for(i=0;i<n;i++){ l=0,r=n-1; flag=(tryCombination(s)==i); while(l<r){ mid=(l+r)/2; for(j=l;j<=mid;j++)if(ans[j]==-1)s[i]=1; now=(tryCombination(s)==i); for(j=l;j<=mid;j++)if(ans[i]==-1)s[i]=0; if(flag==now)l=mid+1; else r=mid; } ans[l]=i,s[i]=flag; } answer(s,ans); return ; }

Compilation message (stderr)

cave.cpp:6:7: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 | int s[n],ans[N];
      |       ^
      |       yn
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:9:9: error: declaration of 'int n' shadows a parameter
    9 |     int n;
      |         ^
cave.cpp:8:22: note: 'int n' previously declared here
    8 | void exploreCave(int n){
      |                  ~~~~^
cave.cpp:10:9: error: 'i' was not declared in this scope
   10 |     for(i=0;i<n;i++)ans[i]=-1;
      |         ^
cave.cpp:11:9: error: 'i' was not declared in this scope
   11 |     for(i=0;i<n;i++){
      |         ^
cave.cpp:12:9: error: 'l' was not declared in this scope
   12 |         l=0,r=n-1;
      |         ^
cave.cpp:12:13: error: 'r' was not declared in this scope
   12 |         l=0,r=n-1;
      |             ^
cave.cpp:13:9: error: 'flag' was not declared in this scope
   13 |         flag=(tryCombination(s)==i);
      |         ^~~~
cave.cpp:13:30: error: 's' was not declared in this scope
   13 |         flag=(tryCombination(s)==i);
      |                              ^
cave.cpp:15:13: error: 'mid' was not declared in this scope
   15 |             mid=(l+r)/2;
      |             ^~~
cave.cpp:16:17: error: 'j' was not declared in this scope
   16 |             for(j=l;j<=mid;j++)if(ans[j]==-1)s[i]=1;
      |                 ^
cave.cpp:17:13: error: 'now' was not declared in this scope; did you mean 'pow'?
   17 |             now=(tryCombination(s)==i);
      |             ^~~
      |             pow
cave.cpp:18:17: error: 'j' was not declared in this scope
   18 |             for(j=l;j<=mid;j++)if(ans[i]==-1)s[i]=0;
      |                 ^
cave.cpp:24:12: error: 's' was not declared in this scope
   24 |     answer(s,ans);
      |            ^