제출 #696231

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6962312023-02-06 02:53:24aSSSdHolding (COCI20_holding)C++14
110 / 110
158 ms119288 KiB
#include<bits/stdc++.h>
using namespace std;
const int N=105;
int a[N],pref[N],dp[N][N][N*N/4];
int main()
{
//freopen("ngu.inp","r",stdin);
int n,l,r,k;
cin >> n >> l >> r >> k;
for(int i=1;i<=n;++i)
{
cin >> a[i];
pref[i]=pref[i-1]+a[i];
}
k=min(k,n*n/4);
memset(dp,50,sizeof dp);
if(l!=1) dp[1][l][k]=pref[r]-pref[l-1];
else dp[r+1][l][k]=pref[r]-pref[l-1];
int ans=dp[0][0][0];
for(int i=1;i<=n;++i)
{
for(int j=1;j<=n;++j)
{
for(int p=0;p<=k;++p)
{
ans=min(ans,dp[i][j][p]);
if(i>=l&&i<=r) continue;
int nxti=i+1;
if(nxti>=l&&nxti<=r) nxti=r+1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...