| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 36478 | UncleGrandpa925 | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 33612 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.
/*input
6 1 3
8 1 2 1 5 4
*/
#include <bits/stdc++.h>
using namespace std;
#define sp ' '
#define endl '\n'
#define fi first
#define se second
#define mp make_pair
#define int long long
#define N 2005
#define bit(x,y) ((x>>y)&1LL)
#define na(x) (#x) << ":" << x
ostream& operator << (ostream &os, vector<int>&x) {
	for (int i = 0; i < x.size(); i++) os << x[i] << sp;
	return os;
}
ostream& operator << (ostream &os, pair<int, int> x) {
	cout << x.fi << sp << x.se << sp;
	return os;
}
ostream& operator << (ostream &os, vector<pair<int, int> >&x) {
	for (int i = 0; i < x.size(); i++) os << x[i] << endl;
	return os;
}
int n, A, B;
int a[N], sum[N];
int dp[N][N];
int getSum(int l, int r) {
	return sum[r] - sum[l - 1];
}
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> A >> B;
	for (int i = 1; i <= n; i++) cin >> a[i], sum[i] = sum[i - 1] + a[i];
	for (int i = 1; i <= n; i++) dp[i][1] = getSum(1, i);
	for (int k = 2; k <= B; k++) {
		for (int i = 1; i <= n; i++) {
			dp[i][k] = 1e18;
			for (int j = 1; j <= i; j++) {
				dp[i][k] = min(dp[i][k], dp[j - 1][k - 1] | getSum(j, i));
			}
		}
	}
	int ans = 1e18;
	for (int i = A; i <= B; i++) ans = min(ans, dp[n][i]);
	cout << ans << endl;
}
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... | ||||
