# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
848139 |
2023-09-11T12:31:26 Z |
asd12343 |
Feast (NOI19_feast) |
C++14 |
|
3 ms |
604 KB |
#include<bits/stdc++.h>
#define el '\n'
using namespace std ;
const int MN = 5e3 + 10 ;
const int mod = 1e9 + 7;
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int Rand(int l, int h){
return l + (1LL * rd() * rd() % (h - l + 1) + (h - l + 1)) % (h - l + 1);
}
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 |
3 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |