Problem knapsack
User LL
Submission Time 2026-02-16 17:16:29
Score 0
Max Time N/A
Max Memory N/A

Compile Error

knapsack.cpp:11:1: error: expected initializer before ‘ll’
11 | ll dp[2005];
| ^~
knapsack.cpp: In function ‘void check(ll, ll)’:
knapsack.cpp:16:13: error: ‘opt’ was not declared in this scope
16 | ll v = arr[opt[i] S] F F;
| ^~~
knapsack.cpp:21:22: error: ‘dp’ was not declared in this scope
21 | if(curr_w >= w and dp[curr_w-w]< dp[curr_w] + v){
| ^~
knapsack.cpp: In function ‘int main()’:
knapsack.cpp:41:3: error: ‘opt’ was not declared in this scope
41 | opt[i] F = v/w;
| ^~~
knapsack.cpp:44:15: error: expected ‘;’ before ‘sort’
44 | arr[n] S = -1
| ^
| ;
45 |
46 | sort(opt, opt + n, greater<pll>());
| ~~~~
knapsack.cpp:50:7: error: ‘dp’ was not declared in this scope
50 | sort(dp, dp +2005);
| ^~