Submission #1017344

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10173442024-07-09 07:30:42vjudge1Holding (COCI20_holding)C++17
110 / 110
41 ms4444 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const N=105;
int const K=10005;
int const mod=1e9+7;
int dp_pre[2][N][K],dp_suf[N][2][K];
int arr[N];
int main(){
int n,L,R,k;
cin>>n>>L>>R>>k;
for (int i = 1; i <=n; ++i)
cin>>arr[i];
int debt=0;
for (int i = L; i <=R; ++i)
debt+=arr[i];
//compute dp_pre;
for(int l=L-1;l>=1;l--)
for(int r=L;r<=R;r++)
for(int c=0;c<=k;c++){
dp_pre[l%2][r][c]=max(dp_pre[(l+1)%2][r][c],dp_pre[l%2][r-1][c]);
if(c>=r-l)
dp_pre[l%2][r][c]=max(dp_pre[l%2][r][c],dp_pre[(l+1)%2][r-1][c-(r-l)]+max(0,(arr[r]-arr[l])));
}
//compute suf_dp;
for(int r=R+1;r<=n;r++)
for(int l=R;l>=L;l--)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...