# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
848140 |
2023-09-11T12:32:23 Z |
asd12343 |
Feast (NOI19_feast) |
C++17 |
|
293 ms |
214608 KB |
#include<bits/stdc++.h>
#define el '\n'
using namespace std ;
const int MN = 2e6 + 10 ;
const int mod = 1e9 + 7;
int a[MN] , n , k;
int dp[5000][5000];
signed main (){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> k;
for ( int i = 1 ; i <= n ; i++ ) cin >> a[i];
for (int i = 1 ; i <= n ; i++) {
for (int j = 0 ; j <= k ; j++) {
dp[i][j+1] = max(dp[i][j+1],dp[i-1][j]);
dp[i][j] = max(dp[i][j],dp[i-1][j] + a[i]);
}
}
int ans = 0;
for ( int i = 0 ; i <= k ; i++ ) ans = max(ans , dp[n][i]);
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
293 ms |
214608 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
65 ms |
51368 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
77 ms |
51280 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
293 ms |
214608 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |