Problem knapsack
User R9q5P8
Submission Time 2026-04-19 15:01:45
Score 0
Max Time N/A
Max Memory N/A

Compile Error

knapsack.cpp: In function ‘int main()’:
knapsack.cpp:18:12: error: ‘cnt’ was not declared in this scope; did you mean ‘int’?
18 | while (cnt > 0)
| ^~~
| int
knapsack.cpp:21:27: error: ‘wt’ was not declared in this scope; did you mean ‘w’?
21 | items.push_back({{wt * take, vl * take}, 1});
| ^~
| w
knapsack.cpp:21:38: error: ‘vl’ was not declared in this scope
21 | items.push_back({{wt * take, vl * take}, 1});
| ^~
knapsack.cpp:21:52: error: no matching function for call to ‘std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::push_back(<brace-enclosed initializer list>)’
21 | items.push_back({{wt * take, vl * take}, 1});
| ^
In file included from /usr/i