QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#68061 | #4585. Greedy Knapsack | HuangHanSheng | Compile Error | / | / | C++98 | 1022b | 2022-12-14 12:54:36 | 2022-12-14 12:54:37 |
Due to the privacy settings of the submitter, you are not allowed to view this code.
詳細信息
answer.code:2:15: error: expected ‘:’ before ‘int’ 2 | public int knapsackProblem(int[] wt,int[] val,int size){ | ^~~~ | : answer.code:2:42: error: expected ‘,’ or ‘...’ before ‘wt’ 2 | public int knapsackProblem(int[] wt,int[] val,int size){ | ^~ answer.code:27:2: error: expected ‘;’ after class definition 27 | } | ^ | ; answer.code: In member function ‘int solution::knapsackProblem(int*)’: answer.code:4:20: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ 4 | int[][] dp = new int[wt.length][size]; | ^ answer.code:4:20: error: structured binding declaration cannot have type ‘int’ 4 | int[][] dp = new int[wt.length][size]; | ^~ answer.code:4:20: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ answer.code:4:20: error: empty structured binding declaration answer.code:4:22: error: expected initializer before ‘[’ token 4 | int[][] dp = new int[wt.length][size]; | ^ answer.code:6:35: error: ‘size’ was not declared in this scope 6 | for(int i = 0;i < size;i++){ | ^~~~ answer.code:7:25: error: expected identifier before numeric constant 7 | int[0][i] = 0; | ^ answer.code:7:25: error: expected ‘]’ before numeric constant answer.code:7:24: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ 7 | int[0][i] = 0; | ^ answer.code:7:24: error: structured binding declaration cannot have type ‘int’ answer.code:7:24: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ answer.code:7:24: error: empty structured binding declaration answer.code:7:27: error: expected initializer before ‘[’ token 7 | int[0][i] = 0; | ^ answer.code:10:35: error: ‘size’ was not declared in this scope 10 | for(int j = 0;j < size;j++){ | ^~~~ answer.code:11:24: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ 11 | int[j][0] = 0; | ^ answer.code:11:24: error: structured binding declaration cannot have type ‘int’ 11 | int[j][0] = 0; | ^~~ answer.code:11:24: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ answer.code:11:25: error: redeclaration of ‘auto j’ 11 | int[j][0] = 0; | ^ answer.code:10:25: note: ‘int j’ previously declared here 10 | for(int j = 0;j < size;j++){ | ^ answer.code:11:27: error: expected initializer before ‘[’ token 11 | int[j][0] = 0; | ^ answer.code:11:27: error: expected ‘;’ before ‘[’ token answer.code:14:36: error: ‘N’ was not declared in this scope 14 | for(int i = 1;i <= N;i++){ | ^ answer.code:16:40: error: ‘W’ was not declared in this scope 16 | for(int j = 0;j <= W;j++){ | ^ answer.code:18:29: error: ‘wt’ was not declared in this scope 18 | if (wt[i] > W) { | ^~ answer.code:19:29: error: ‘dp’ was not declared in this scope 19 | dp[i][W] = dp[i-1][W]; //??????? | ^~ answer.code:22:29: error: ‘dp’ was not declared in this scope 22 | dp[i][W] = Math.max(dp[i-1][W],dp[i-1][W-wt[i]] + val[i]) | ^~ answer.code:22:40: error: ‘Math’ was not declared in this scope 22 | dp[i][W] = Math.max(dp[i-1][W],dp[i-1][W-wt[i]] + val[i]) | ^~~~ answer.code:22:79: error: ‘val’ was not declared in this scope 22 | dp[i][W] = Math.max(dp[i-1][W],dp[i-1][W-wt[i]] + val[i]) | ^~~ answer.code:26:9: warning: no return statement in function returning non-void [-Wreturn-type] 26 | } | ^