# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
970013 | 2024-04-26T05:56:34 Z | blackslex | Feast (NOI19_feast) | C++17 | 115 ms | 262144 KB |
#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(n + 5, vector<ll>(k + 5)); vector<ll> dp2(k + 5); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), pref[i] = pref[i - 1] + a[i]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= k; j++) dp[i][j] = max(dp[i - 1][j], dp2[j - 1] + pref[i]); for (int j = 0; j <= k; j++) dp2[j] = max(dp2[j], dp[i][j] - pref[i]); } printf("%lld", dp[n][k]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 115 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 30048 KB | Output is correct |
2 | Correct | 50 ms | 31904 KB | Output is correct |
3 | Correct | 47 ms | 31208 KB | Output is correct |
4 | Runtime error | 96 ms | 262144 KB | Execution killed with signal 9 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 30604 KB | Output is correct |
2 | Correct | 45 ms | 33108 KB | Output is correct |
3 | Correct | 46 ms | 33344 KB | Output is correct |
4 | Correct | 47 ms | 33152 KB | Output is correct |
5 | Correct | 45 ms | 33532 KB | Output is correct |
6 | Correct | 46 ms | 33628 KB | Output is correct |
7 | Correct | 53 ms | 33812 KB | Output is correct |
8 | Correct | 49 ms | 33364 KB | Output is correct |
9 | Correct | 45 ms | 33828 KB | Output is correct |
10 | Correct | 46 ms | 33620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 608 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 608 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 2 ms | 3416 KB | Output is correct |
22 | Correct | 16 ms | 26048 KB | Output is correct |
23 | Correct | 4 ms | 6492 KB | Output is correct |
24 | Correct | 4 ms | 3916 KB | Output is correct |
25 | Correct | 3 ms | 5212 KB | Output is correct |
26 | Correct | 2 ms | 3164 KB | Output is correct |
27 | Correct | 4 ms | 4700 KB | Output is correct |
28 | Correct | 1 ms | 1124 KB | Output is correct |
29 | Correct | 1 ms | 860 KB | Output is correct |
30 | Correct | 1 ms | 444 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 115 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |