Submission #1028559

#TimeUsernameProblemLanguageResultExecution timeMemory
1028559vjudge1Bali Sculptures (APIO15_sculpture)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,A,B; cin>>n>>A>>B; int a[n], dp[n][B], su=0; for (int i=0;i<n;i++) for (int j=0;j<B;j++) dp[i][j]=2e9; for (int i=0;i<n;i++) cin>>a[i],su+=a[i],dp[i][0]=su; for (int len=1;len<B;len++) for (int i=len;i<n;i++) { su=0; for (int j=i;j>len-1;j--) su+=a[j],dp[i][len]=min(dp[i][len],su|dp[j-1][len-1]); } int ans=2e9; for (int i=A-1;i<B;i++) ans=min(ans,dp[n-1][i]); cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...