Problem knapsack
User AJigglypuffCoder
Submission Time 2025-02-03 20:07:23
Score 0
Max Time N/A
Max Memory N/A

Compile Error

knapsack.cpp: In function ‘int main()’:
knapsack.cpp:57:41: error: request for member ‘items’ in ‘j’, which is of non-class type ‘int’
57 | tmp[j] = (old_tmp[j-items[i].W]-j.items[i].V)>old_tmp[j] ? old_tmp[j-items[i].W]-j.items[i].V : old_tmp[j];
| ^~~~~
knapsack.cpp:57:90: error: request for member ‘items’ in ‘j’, which is of non-class type ‘int’
57 | tmp[j] = (old_tmp[j-items[i].W]-j.items[i].V)>old_tmp[j] ? old_tmp[j-items[i].W]-j.items[i].V : old_tmp[j];
| ^~~~~
knapsack.cpp:61:8: error: no match for ‘operator<<’ (operand types are ‘std::ostream’ {aka ‘std::basic_ostream<char>’} and ‘__gnu_cxx::__alloc_traits<std::allocator<item_type>, item_type>::value_type’ {aka ‘item_type’})
61 | cout << tmp[-1];
In file included from /usr/include/c++/9/istream:39,