记录详情

Compile Error

foo.cc: In function ‘int main()’:
foo.cc:7:21: error: declaration of ‘g’ as multidimensional array must have bounds for all dimensions except the first
    7 |                 int g[][] = new int[n + 1][n + 1];
      |                     ^
foo.cc:7:49: error: array size in new-expression must be constant
    7 |                 int g[][] = new int[n + 1][n + 1];
      |                                                 ^
foo.cc:7:49: error: the value of ‘n’ is not usable in a constant expression
foo.cc:5:21: note: ‘int n’ is not const
    5 |                 int n;
      |                     ^
foo.cc:9:61: error: ‘g’ was not declared in this scope
    9 |                         for(int j = 1; j <= i; j ++) cin >> g[i][j];
      |                                                             ^
foo.cc:11:20: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   11 |                 int[][] dp = new int[n + 1][n + 1];
      |                    ^
foo.cc:11:20: error: structured binding declaration cannot have type ‘int’
   11 |                 int[][] dp = new int[n + 1][n + 1];
      |                    ^~
foo.cc:11:20: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’
foo.cc:11:20: error: empty structured binding declaration
foo.cc:11:22: error: expected initializer before ‘[’ token
   11 |                 int[][] dp = new int[n + 1][n + 1];
      |                      ^
foo.cc:14:33: error: ‘dp’ was not declared in this scope
   14 |                                 dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j]) + g[i][j];
      |                                 ^~
foo.cc:14:82: error: ‘g’ was not declared in this scope
   14 |                                 dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j]) + g[i][j];
      |                                                                                  ^
foo.cc:18:61: error: ‘dp’ was not declared in this scope
   18 |                 for(int i = 1; i <= n; i ++) res = max(res, dp[n][i]);
      |                                                             ^~
foo.cc:11:20: warning: unused structured binding declaration [-Wunused-variable]
   11 |                 int[][] dp = new int[n + 1][n + 1];
      |                    ^~

信息

递交者
类型
递交
题目
P1001 数字三角形 Number Triangles
语言
C++
递交时间
2024-03-25 15:43:56
评测时间
2024-03-25 15:43:56
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes