Submission #289158

#TimeUsernameProblemLanguageResultExecution timeMemory
289158Bill_00The Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; int ans,m; int p[200001]={0}; void search(int mid,int l,int r){ vector<int>res=find(mid); if(res[0]+res[1]==0){ ans=mid; return; } if(l==r){ return; } if(res[0]==0){ l=mid+1; mid=mid+1+r>>1; search(mid,l,r); } if(res[1]==0){ r=mid-1; mid=mid+1+r>>1; search(mid,l,r); } if(res[1]!=0 && res[0]!=0){ search((l+mid-1)/2,l,mid-1); search((mid+1+r)/2,mid+1,r); } } int find_best(int n){ m=n; /*for(int i = 0; i < n; i++) { std::vector<int> res = ask(i); if(res[0] + res[1] == 0) return i; }*/ int l=0,r=n-1; int mid=(l+r)>>1; search(mid,l,r); return ans; }

Compilation message (stderr)

prize.cpp: In function 'void search(int, int, int)':
prize.cpp:7:25: error: no matching function for call to 'find(int&)'
    7 |  vector<int>res=find(mid);
      |                         ^
In file included from /usr/include/c++/9/bits/locale_facets.h:48,
                 from /usr/include/c++/9/bits/basic_ios.h:37,
                 from /usr/include/c++/9/ios:44,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from prize.cpp:2:
/usr/include/c++/9/bits/streambuf_iterator.h:373:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)'
  373 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/9/bits/streambuf_iterator.h:373:5: note:   template argument deduction/substitution failed:
prize.cpp:7:25: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int'
    7 |  vector<int>res=find(mid);
      |                         ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from prize.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3930:5: note: candidate: 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
 3930 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/9/bits/stl_algo.h:3930:5: note:   template argument deduction/substitution failed:
prize.cpp:7:25: note:   candidate expects 3 arguments, 1 provided
    7 |  vector<int>res=find(mid);
      |                         ^
prize.cpp:17:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |   mid=mid+1+r>>1;
      |       ~~~~~^~
prize.cpp:22:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   22 |   mid=mid+1+r>>1;
      |       ~~~~~^~