답안 #739702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739702 2023-05-11T04:31:37 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -