Problem knapsack
User cobnet
Submission Time 2025-02-15 13:41:18
Score 0
Max Time N/A
Max Memory N/A

Compile Error

knapsack.cpp:6:26: error: ‘Item’ does not name a type; did you mean ‘tm’?
6 | bool operator<(const Item &other) const {
| ^~~~
| tm
knapsack.cpp: In member function ‘bool object::operator<(const int&) const’:
knapsack.cpp:7:34: error: request for member ‘valueProp’ in ‘other’, which is of non-class type ‘const int’
7 | return valueProp > other.valueProp;
| ^~~~~~~~~
knapsack.cpp: In function ‘int main()’:
knapsack.cpp:29:36: error: ‘__gnu_cxx::__alloc_traits<std::allocator<std::tuple<double, double, double, double> >, std::tuple<double, double, double, double> >::value_type’ {aka ‘class std::tuple<double, double, double, double>’} has no member named ‘weight’
29 | if (capacity < shoppingList[foo].weight) {
| ^~~~~~
knapsack.cpp:32:37: error: ‘__