Submission #155926

#TimeUsernameProblemLanguageResultExecution timeMemory
155926aloo123Bali Sculptures (APIO15_sculpture)C++14
0 / 100
33 ms32340 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define f first #define s second #define mp make_pair #define pb push_back #define vll vector<ll> #define fastio ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL) using namespace std; const ll N = 2020; const ll MOD = 1e9+7; ll dp[N][N]; int main() { fastio; ll n,a,b; cin >> n >>a >> b; ll arr[N]; ll pre[N]; for(int i = 1;i<=n;i++) cin >> arr[i]; pre[0] = 0; pre[1] = arr[1]; for(int i =2;i<=n;i+=1) pre[i] = pre[i-1] + arr[i]; for(int i=0;i<N;i++) for(int j =0;j<N;j++) dp[i][j] = LLONG_MAX; for(int i= 1;i<=n;i++) { dp[i][1] = pre[i]; for(int x = 2;x<=i;x++) { for(int l = 1;l<i;l++) { dp[i][x] = min((dp[l][x-1] | (pre[i]-pre[l])),dp[i][x]); } } } ll ans =LLONG_MAX; for(int i=a;i<=b;i++) { ans=min(ans,dp[n][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...