Submission #1094220

# Submission time Handle Problem Language Result Execution time Memory
1094220 2024-09-29T03:21:44 Z Trisanu_Das Feast (NOI19_feast) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
int dp[2005][2005];
 
signed main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n, k; cin >> n >> k;
  int a[n + 1]; for(int i = 1; i <= n; i++) cin >> a[i];
  for(int i = 1; i <= n; i++) a[i] += a[i - 1];
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= k; j++){
      dp[i][j] = max(dp[i][j], dp[i - 1][j]);
      for(int l = 0; l < i; l++) dp[i][j] = max(dp[i][j], dp[l][j - 1] + a[i] - a[l];
    }
  }
  cout << dp[n][k];
}

Compilation message

feast.cpp: In function 'int main()':
feast.cpp:15:85: error: expected ')' before ';' token
   15 |       for(int l = 0; l < i; l++) dp[i][j] = max(dp[i][j], dp[l][j - 1] + a[i] - a[l];
      |                                                ~                                    ^
      |                                                                                     )