# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
795959 |
2023-07-28T01:12:17 Z |
12345678 |
Feast (NOI19_feast) |
C++17 |
|
264 ms |
143904 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=3e3+5;
ll n, k, dp[nx][nx], v[nx], qs[nx], mx[nx];
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>k;
for (int i=1; i<=n; i++) cin>>v[i], qs[i]=qs[i-1]+v[i];
for (int i=1; i<=n; i++)
{
for (int j=0; j<=k; j++)
{
dp[i][j]=dp[i-1][j];
if (j>0) dp[i][j]=max(mx[j-1]+qs[i], dp[i][j]);
mx[j]=max(mx[j], dp[i][j]-qs[i]);
//cout<<i<<' '<<j<<' '<<dp[i][j]<<'\n';
}
}
cout<<dp[n][k];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
264 ms |
143904 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
62 ms |
28956 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
64 ms |
29080 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
524 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
0 ms |
596 KB |
Output is correct |
9 |
Correct |
0 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
524 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
0 ms |
596 KB |
Output is correct |
9 |
Correct |
0 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
1492 KB |
Output is correct |
12 |
Correct |
1 ms |
1492 KB |
Output is correct |
13 |
Correct |
1 ms |
1364 KB |
Output is correct |
14 |
Correct |
1 ms |
1492 KB |
Output is correct |
15 |
Correct |
1 ms |
1492 KB |
Output is correct |
16 |
Correct |
1 ms |
1364 KB |
Output is correct |
17 |
Correct |
1 ms |
1492 KB |
Output is correct |
18 |
Correct |
1 ms |
1364 KB |
Output is correct |
19 |
Correct |
1 ms |
1364 KB |
Output is correct |
20 |
Correct |
1 ms |
1492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
524 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
0 ms |
596 KB |
Output is correct |
9 |
Correct |
0 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
1492 KB |
Output is correct |
12 |
Correct |
1 ms |
1492 KB |
Output is correct |
13 |
Correct |
1 ms |
1364 KB |
Output is correct |
14 |
Correct |
1 ms |
1492 KB |
Output is correct |
15 |
Correct |
1 ms |
1492 KB |
Output is correct |
16 |
Correct |
1 ms |
1364 KB |
Output is correct |
17 |
Correct |
1 ms |
1492 KB |
Output is correct |
18 |
Correct |
1 ms |
1364 KB |
Output is correct |
19 |
Correct |
1 ms |
1364 KB |
Output is correct |
20 |
Correct |
1 ms |
1492 KB |
Output is correct |
21 |
Correct |
6 ms |
11220 KB |
Output is correct |
22 |
Correct |
20 ms |
33648 KB |
Output is correct |
23 |
Correct |
7 ms |
14008 KB |
Output is correct |
24 |
Correct |
7 ms |
11604 KB |
Output is correct |
25 |
Correct |
6 ms |
13012 KB |
Output is correct |
26 |
Correct |
5 ms |
11092 KB |
Output is correct |
27 |
Correct |
7 ms |
12756 KB |
Output is correct |
28 |
Correct |
4 ms |
9044 KB |
Output is correct |
29 |
Correct |
4 ms |
8788 KB |
Output is correct |
30 |
Correct |
3 ms |
8148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
264 ms |
143904 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |