| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 969925 | blackslex | Feast (NOI19_feast) | C++17 | 1008 ms | 262144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n, k;
int main() {
scanf("%d %d", &n, &k);
vector<ll> a(n + 5), pref(n + 5);
vector<vector<ll>> dp(k + 5, vector<ll>(n + 5)), dp2(n + 5, vector<ll>(n + 5, -1e18));
for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), pref[i] = pref[i - 1] + a[i];
for (int i = 0; i <= n; i++) {
dp2[i][i] = pref[i];
for (int j = i + 1; j <= n; j++) dp2[i][j] = max(dp2[i][j - 1], pref[j]);
}
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= n; j++) {
for (int l = 0; l <= j; l++) dp[i][j] = max(dp[i][j], dp[i - 1][l] + dp2[l][j] - pref[l]);
}
}
printf("%lld", *max_element(dp[k].begin(), dp[k].end()));
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
