Submission #739698

# Submission time Handle Problem Language Result Execution time Memory
739698 2023-05-11T04:21:32 Z Mauve Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
long long m,n,l,r,i,j,ii,jj,k,dp[2005][2005],a[2005],prefix[2005],ans;
#define INF 1000000000000000
int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	cin>>n>>l>>r;
	for(i=1;i<=n;i++) cin>>a[i];
	for(i=0;i<=n;i++) for(j=0;j<=r;j++) dp[i][j]=INF;
	dp[0][1]=0;
	for(i=1;i<=n;i++){
	 dp[i][1]=dp[i-1][1]+a[i];
	 prefix[i]=prefix[i-1]+a[i];
	}
	for(i=1;i<=n;i++){
		for(j=2;j<=r;j++){
			for(k=1;k<i;k++) dp[i][j]=min(dp[i][j],( dp[k][j-1] | (prefix[i]-prefix[k]) ));
		}
	}
	ans=INF;
	for(i=l;i<=r;i++) ans=min(ans,dp[n][i]);
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -