제출 #1309700

#제출 시각아이디문제언어결과실행 시간메모리
1309700aaaaaaaaFeast (NOI19_feast)C++20
0 / 100
1098 ms327680 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); int n, k; cin >> n >> k; vector<int> a(n + 1, 0); vector<vector<int>> dp(n + 5, vector<int>(k + 5, 0)); for(int i = 1; i <= n; ++i){ cin >> a[i]; } for(int i = 1; i <= n; ++i){ for(int j = 1; j <= k; ++j){ dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - 1]); for(int x = i, s = 0; x >= 1; --x){ s += a[x]; dp[i][j] = max(dp[i][j], s + dp[x - 1][j - 1]); } } } cout << dp[n][k] << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...