Problem potatosalad
User Henries
Submission Time 2024-09-29 22:01:25
Score 0
Max Time N/A
Max Memory N/A

Compile Error

potatosalad.cpp: In function ‘int main()’:
potatosalad.cpp:13:30: error: cannot convert ‘__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >’ to ‘long long int’ in initialization
13 | long long max = max_element(v.begin(),v.end());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
| |
| __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
potatosalad.cpp:14:16: error: invalid type argument of unary ‘*’ (have ‘long long int’)
14 | sum = sum + *max;
| ^~~
potatosalad.cpp:15:14: error: no matching function for call to ‘std::vector<long long int>::erase(long long int&)’
15 | v.erase(max);
| ^
In file included from /usr/include/c++/9/vector:67,
from /usr/include/c++/9/functional:62,
from /usr/include/c++/9/pstl/glu