Problem catlunch
User AltheaZ
Submission Time 2023-10-25 08:39:35
Score 0
Max Time N/A
Max Memory N/A

Compile Error

catlunch.cpp: In function ‘int main()’:
catlunch.cpp:14:31: error: no matching function for call to ‘max_element(std::vector<int>::iterator, int&)’
14 | if (*max_element(t.begin(),k)>=0){
| ^
In file included from /usr/include/c++/9/algorithm:62,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
from catlunch.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:5713:5: note: candidate: ‘template<class _FIter> constexpr _FIter std::max_element(_FIter, _FIter)’
5713 | max_element(_ForwardIterator __first, _ForwardIterator __last)
| ^~~~~~~~~~~
/usr/include/c++/9/bits/stl_algo.h:5713:5: note: template argument deduction/substitution failed:
catlunch.cpp:14:31: note: deduced conflicting types for parameter ‘_FIter’ (‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ and ‘int’)
14 | if (*max_element(t.begin(),k)>=0){