# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
563431 | penguin133 | Bali Sculptures (APIO15_sculpture) | C++14 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int A[200005] ,P[200005];
int dp[2005][2005];
main(){
ios::sync_with_stdio(0);cin.tie(0);
int n,a,b;
cin >> n >> a >> b;
for(int i=1;i<=n;i++)cin >> A[i], P[i] = P[i-1] + A[i];
for(int i=1;i<=n;i++)dp[0][i] = dp[i][0] = 1e18;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
dp[i][j] = 1e18;
if(j > i)continue;
for(int k=i-1;k>=0;k--){
dp[i][j] = min(dp[i][j], (dp[k][j-1] | (P[i] - P[k])));
}
}
}
/*
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++)cout << dp[i][j] << " ";
cout << '\n';
}
*/
int ans = 1e18;
for(int i=a;i<=b;i++)ans = min(ans, dp[n][i]);
cout << ans << '\n';
//cout << (8|1) << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |