Problem lunchbox
User elianchew
Submission Time 2026-06-23 17:01:21
Score 0
Max Time N/A
Max Memory N/A

Compile Error

lunchbox.cpp: In function ‘int main()’:
lunchbox.cpp:6:14: error: conflicting declaration ‘std::vector<int> k’
6 | vector<int> k(m);
| ^
lunchbox.cpp:4:6: note: previous declaration as ‘int k’
4 | int k, n, m;
| ^
lunchbox.cpp:8:13: error: invalid types ‘int[int]’ for array subscript
8 | cin >> k[i]
| ^
lunchbox.cpp:10:9: error: request for member ‘begin’ in ‘k’, which is of non-class type ‘int’
10 | sort(k.begin(), k.end());
| ^~~~~
lunchbox.cpp:10:20: error: request for member ‘end’ in ‘k’, which is of non-class type ‘int’
10 | sort(k.begin(), k.end());
| ^~~
lunchbox.cpp:12:15: error: invalid types ‘int[int]’ for array subscript
12 | if (n >= k[i]) {
| ^
lunchbox.cpp:13:12: error: invalid types ‘int[int]’ for array subscript
13 | n <= k[i];
|