Problem lengthsort
User AltheaZ
Submission Time 2023-06-30 12:47:01
Score 0
Max Time N/A
Max Memory N/A

Compile Error

lengthsort.cpp: In function ‘int main()’:
lengthsort.cpp:16:65: error: no matching function for call to ‘distance(int, __gnu_cxx::__normal_iterator<int*, std::vector<int> >)’
16 | int maxele=distance(0,max_element(length.begin(),length.end()));
| ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:66,
from /usr/include/c++/9/bits/char_traits.h:39,
from /usr/include/c++/9/ios:40,
from /usr/include/c++/9/ostream:38,
from /usr/include/c++/9/iostream:39,
from lengthsort.cpp:1:
/usr/include/c++/9/bits/stl_iterator_base_funcs.h:138:5: note: candidate: ‘template<class _InputIterator> constexpr typename std::iterator_traits<_Iterator>::difference_type std::distance(_InputIterator, _InputIterator)’
138 | distance(_InputIterator __first, _InputIterator __last)