Submission #622588

#TimeUsernameProblemLanguageResultExecution timeMemory
622588stoyan_malininThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include "prize.h" #ifdef _LOCAL_ #include "grader.cpp" #endif // _LOCAL_ int solve(int l, int r, vector <int> lRes, vector <int> rRes) { if(lRes==rRes) return -1; int mid = (l+r)/2; vector <int> midRes = ask(mid); if(midRes==vector <int>{0, 0}) return mid; else if(l==r) return -1; int solL = solve(l, mid, lRes, midRes); if(solL!=-1) return solL; int solR = solve(mid, r, midRes, rRes); return solR; } int find_best(int n) { vector <int> lRes = ask(0); vector <int> rRes = ask(n-1); if(lRes==vector <int>{0, 0}) return 0; if(rRes==vector <int>{0, 0}) return n-1; return solve(0, n-1, lRes, rRes); }

Compilation message (stderr)

prize.cpp:7:25: error: 'vector' has not been declared
    7 | int solve(int l, int r, vector <int> lRes, vector <int> rRes)
      |                         ^~~~~~
prize.cpp:7:32: error: expected ',' or '...' before '<' token
    7 | int solve(int l, int r, vector <int> lRes, vector <int> rRes)
      |                                ^
prize.cpp: In function 'int solve(int, int, int)':
prize.cpp:9:8: error: 'lRes' was not declared in this scope
    9 |     if(lRes==rRes) return -1;
      |        ^~~~
prize.cpp:9:14: error: 'rRes' was not declared in this scope
    9 |     if(lRes==rRes) return -1;
      |              ^~~~
prize.cpp:12:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   12 |     vector <int> midRes = ask(mid);
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/10/vector:67,
                 from prize.h:1,
                 from prize.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
prize.cpp:12:13: error: expected primary-expression before 'int'
   12 |     vector <int> midRes = ask(mid);
      |             ^~~
prize.cpp:14:8: error: 'midRes' was not declared in this scope
   14 |     if(midRes==vector <int>{0, 0}) return mid;
      |        ^~~~~~
prize.cpp:14:24: error: expected primary-expression before 'int'
   14 |     if(midRes==vector <int>{0, 0}) return mid;
      |                        ^~~
prize.cpp:14:24: error: expected ')' before 'int'
   14 |     if(midRes==vector <int>{0, 0}) return mid;
      |       ~                ^~~
      |                        )
prize.cpp:17:30: error: 'lRes' was not declared in this scope
   17 |     int solL = solve(l, mid, lRes, midRes);
      |                              ^~~~
prize.cpp:17:36: error: 'midRes' was not declared in this scope
   17 |     int solL = solve(l, mid, lRes, midRes);
      |                                    ^~~~~~
prize.cpp:20:38: error: 'rRes' was not declared in this scope
   20 |     int solR = solve(mid, r, midRes, rRes);
      |                                      ^~~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:26:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   26 |     vector <int> lRes = ask(0);
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/10/vector:67,
                 from prize.h:1,
                 from prize.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
prize.cpp:26:13: error: expected primary-expression before 'int'
   26 |     vector <int> lRes = ask(0);
      |             ^~~
prize.cpp:27:13: error: expected primary-expression before 'int'
   27 |     vector <int> rRes = ask(n-1);
      |             ^~~
prize.cpp:29:8: error: 'lRes' was not declared in this scope
   29 |     if(lRes==vector <int>{0, 0}) return 0;
      |        ^~~~
prize.cpp:29:22: error: expected primary-expression before 'int'
   29 |     if(lRes==vector <int>{0, 0}) return 0;
      |                      ^~~
prize.cpp:29:22: error: expected ')' before 'int'
   29 |     if(lRes==vector <int>{0, 0}) return 0;
      |       ~              ^~~
      |                      )
prize.cpp:30:8: error: 'rRes' was not declared in this scope
   30 |     if(rRes==vector <int>{0, 0}) return n-1;
      |        ^~~~
prize.cpp:30:22: error: expected primary-expression before 'int'
   30 |     if(rRes==vector <int>{0, 0}) return n-1;
      |                      ^~~
prize.cpp:30:22: error: expected ')' before 'int'
   30 |     if(rRes==vector <int>{0, 0}) return n-1;
      |       ~              ^~~
      |                      )
prize.cpp:32:26: error: 'lRes' was not declared in this scope
   32 |     return solve(0, n-1, lRes, rRes);
      |                          ^~~~
prize.cpp:32:32: error: 'rRes' was not declared in this scope
   32 |     return solve(0, n-1, lRes, rRes);
      |                                ^~~~