Submission #976458

#TimeUsernameProblemLanguageResultExecution timeMemory
976458nninBali Sculptures (APIO15_sculpture)C++14
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int N, A, B; ll sum[2005], dp[2005][2005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>N>>A>>B; for(int i=1;i<=N;i++) cin>>sum[i], sum[i] += sum[i-1]; for(int i=1;i<=N;i++) for(int j=0;j<B;j++) dp[i][j] = 1e18; for(int i=1;i<=N;i++) dp[i][0] = sum[i]; for(int j=1;j<B;j++) { for(int i=1;i<=N;i++) { for(int k=1;k<i;k++) { dp[i][j] = min(dp[i][j], dp[k][j-1]|(sum[i]-sum[k])); } } } ll ans = 1e18; for(int j=A-1;j<B;j++) ans = min(ans, dp[N][j]); cout<<ans; }
#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...