Submission #314092

#TimeUsernameProblemLanguageResultExecution timeMemory
314092lukameladzeThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include "prize.h" # include <bits/stdc++.h> int find_best(int n) { vector<int> res; int le,l,x1,x2,mx,mid,ri,ans; for (int i=1; i<=500; i++) { res=ask(i); if (res[0]+res[1]==0) { return i; } if (res[0]+res[1]>=mx) { mx=res[0]+res[1]; l=i; x1=res[0]; x2=res[1]; } } while (true) { le=l+1; ri=n; while (le<=ri) { mid=(le+ri)/2; res=ask(mid); if (res[0]+res[1]!=mx) { ans=mid; } if (res[0]==x1 && res[0]+res[1]==mx) { le=mid+1; } else { ri=mid-1; } } for (int i=ans+1; i<=n; i++) { res=ask(i); if (res[0]+res[1]==0) { return i; } if (res[0]+res[1]==mx) { l=i; x1=res[0]; break; } } } }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:6:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    6 |     vector<int> res;
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/9/vector:67,
                 from prize.h:1,
                 from prize.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
prize.cpp:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> res;
      |            ^~~
prize.cpp:11:11: error: 'res' was not declared in this scope
   11 |           res=ask(i);
      |           ^~~
prize.cpp:32:16: error: 'res' was not declared in this scope
   32 |                res=ask(mid);
      |                ^~~
prize.cpp:48:16: error: 'res' was not declared in this scope
   48 |                res=ask(i);
      |                ^~~