제출 #1094219

#제출 시각아이디문제언어결과실행 시간메모리
1094219Trisanu_DasFeast (NOI19_feast)C++17
컴파일 에러
0 ms0 KiB
#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[p]); } } cout << dp[n][k]; }

컴파일 시 표준 에러 (stderr) 메시지

feast.cpp: In function 'int main()':
feast.cpp:15:83: error: 'p' was not declared in this scope
   15 |       for(int l = 0; l < i; l++) dp[i][j] = max(dp[i][j], dp[l][j - 1] + a[i] - a[p]);
      |                                                                                   ^