| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1357284 | sim_ple | Feast (NOI19_feast) | C++20 | 7 ms | 3396 KiB |
/*
written by sim_ple
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define N 309
#define itn int
#define all(x) x.begin() , x.end()
int dp[N][N] , pref[N];
void solve(){
int n , K;
cin >> n >> K;
int a[n + 1];
for(int i = 1; i <= n; i++){
cin >> a[i];
pref[i] = pref[i - 1] + a[i];
}
for(int k = 1; k <= K; k++){
for(int j = 1; j <= n; j++){
dp[j][k] = dp[j - 1][k];
for(int i = 1; i <= j; i++){
dp[j][k] = max(dp[j][k] , dp[i - 1][k - 1] + pref[j] - pref[i - 1]);
}
}
}
cout << dp[n][K] << endl;
}
int32_t main() {
ios::sync_with_stdio(false);cin.tie(nullptr);
int t = 1;
//cin >> t;
while(t--) solve();
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
