| Problem | 01knapsack |
|---|---|
| User | benji9736 |
| Submission Time | 2025-12-26 19:09:58 |
| Score | 0 |
| Max Time | N/A |
| Max Memory | N/A |
Owl Get a Life
01knapsack.cpp: In function ‘int main()’:
01knapsack.cpp:8:17: error: conflicting declaration ‘std::vector<int> w’
8 | vector<int> w(n);
| ^
01knapsack.cpp:6:12: note: previous declaration as ‘int w’
6 | int n, w;
| ^
01knapsack.cpp:11:17: error: invalid types ‘int[int]’ for array subscript
11 | cin>>w[i]>>v[i];
| ^
01knapsack.cpp:15:39: error: invalid types ‘int[int]’ for array subscript
15 | for (int curw = w; curw >= w[i]; curw--){
| ^
01knapsack.cpp:16:51: error: invalid types ‘int[int]’ for array subscript
16 | dp[curw] = max(dp[curw], dp[curw - w[i]] + v[i]);
| ^