Submission #791585

# Submission time Handle Problem Language Result Execution time Memory
791585 2023-07-24T07:42:30 Z akari Feast (NOI19_feast) C++14
0 / 100
61 ms 1952 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define ii pair<ll,ll>
const ll maxn=2e5+2;

int a[maxn];
ll dp[2002][2006];
ll ans;

int main(){
    int n,k; cin>>n>>k;    
    for (int i=1;i<=n;++i) cin>>a[i];
    for (int j=1;j<=k;++j){
        for (int i=1;i<=n;++i){
            dp[i][j]=max({dp[i-1][j]+a[i], dp[i-1][j-1]+a[i],dp[i][j],dp[i-1][j-1]});
            //cout<<dp[i][j]<<" ";
            ans=max(ans,dp[i][j]);
        }
        //cout<<endl;
    }
    cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 56 ms 1880 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 1872 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 61 ms 1952 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Incorrect 1 ms 596 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Incorrect 1 ms 596 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Incorrect 1 ms 596 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 56 ms 1880 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -