Problem lunchbox
User Feiyang
Submission Time 2025-06-18 15:32:31
Score 0
Max Time N/A
Max Memory N/A

Compile Error

lunchbox.cpp: In function ‘int main()’:
lunchbox.cpp:18:28: error: no matching function for call to ‘std::vector<int>::back(int&)’
18 | if (n-vec.back(counter2)>=1) {
| ^
In file included from /usr/include/c++/9/vector:67,
from /usr/include/c++/9/functional:62,
from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/9/algorithm:71,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
from lunchbox.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1140:7: note: candidate: ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::back() [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&]’
1140 | back() _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/9/bits/stl_vector.h:1140:7: note: candidate expects 0 arguments, 1