Problem arrayfind
User Batigol
Submission Time 2026-05-09 10:44:14
Score 0
Max Time N/A
Max Memory N/A

Compile Error

arrayfind.cpp: In function ‘int main()’:
arrayfind.cpp:19:64: error: no match for ‘operator-’ (operand types are ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ and ‘std::vector<int>’)
19 | cout<<"Smaller: "<<lower_bound(vec.begin(),vec.end(),x)-vec<<", Greater: "<<vec.end()-upper_bound(vec.begin(),vec.end(),x)<<endl;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
| | |
| | std::vector<int>
| __gnu_cxx::__normal_iterator<int*, std::vector<int> >
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
from /usr/include/c++/9/bits/specfun.h:45,
from /usr/include/c++/9/cmath:1927,
from /usr/include/x86_64-linux-