Submission #163128

#TimeUsernameProblemLanguageResultExecution timeMemory
163128mhy908Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" int now[5010], where[5010]; bool ch[5010]; void rev(int a, int b){ for(int i=a; i<=b; i++)if(!ch[i])now[i]^=1; } void binsearch(int st, int fin, bool fl, int num){ if(st==fin)return st; int mid=(st+fin)/2; if(fl){ rev(a, mid); if(tryCombination(now)!=num){ rev(a, mid); return binsearch(st, mid, fl, num); } rev(a, mid); return binsearch(mid+1, fl, num); } else{ rev(a, mid); if(tryCombination(now)==num){ rev(a, mid); return binsearch(st, mid, fl, num); } rev(a, mid); return binsearch(mid+1, fl, num); } } void exploreCave(int n){ for(int i=0; i<n; i++){ int temp=tryCombination(now); int but=binsearch(0, n-1, temp==i); if(temp==i){ where[but]=i; ch[but]=true; } else{ where[but]=i; rev(but, but); ch[but]=true; } } answer(now, where); }

Compilation message (stderr)

cave.cpp: In function 'void binsearch(int, int, bool, int)':
cave.cpp:8:23: error: return-statement with a value, in function returning 'void' [-fpermissive]
     if(st==fin)return st;
                       ^~
cave.cpp:11:13: error: 'a' was not declared in this scope
         rev(a, mid);
             ^
cave.cpp:17:40: error: too few arguments to function 'void binsearch(int, int, bool, int)'
         return binsearch(mid+1, fl, num);
                                        ^
cave.cpp:7:6: note: declared here
 void binsearch(int st, int fin, bool fl, int num){
      ^~~~~~~~~
cave.cpp:17:40: error: return-statement with a value, in function returning 'void' [-fpermissive]
         return binsearch(mid+1, fl, num);
                                        ^
cave.cpp:20:13: error: 'a' was not declared in this scope
         rev(a, mid);
             ^
cave.cpp:26:40: error: too few arguments to function 'void binsearch(int, int, bool, int)'
         return binsearch(mid+1, fl, num);
                                        ^
cave.cpp:7:6: note: declared here
 void binsearch(int st, int fin, bool fl, int num){
      ^~~~~~~~~
cave.cpp:26:40: error: return-statement with a value, in function returning 'void' [-fpermissive]
         return binsearch(mid+1, fl, num);
                                        ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:32:42: error: too few arguments to function 'void binsearch(int, int, bool, int)'
         int but=binsearch(0, n-1, temp==i);
                                          ^
cave.cpp:7:6: note: declared here
 void binsearch(int st, int fin, bool fl, int num){
      ^~~~~~~~~