Submission #32298

# Submission time Handle Problem Language Result Execution time Memory
32298 2017-10-06T18:39:40 Z RezwanArefin01 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
0 ms 33436 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii; 

const int maxn = 2005; 
ll dp[maxn][maxn], sum[maxn];

int main(int argc, char const *argv[]) {
#ifdef LOCAL_TESTING
	freopen("in", "r", stdin);
#endif
	int n, a, b; 
	cin >> n >> a >> b;
	for(int i = 1; i <= n; i++) {
		cin >> sum[i]; sum[i] += sum[i-1];
	}
	for(int i = 0; i <= n; i++) 
		dp[0][i] = sum[i];
	for(int k = 1; k < b; k++) {
		for(int i = 1; i <= n; i++) {
			dp[k][i] = 1e18;
			for(int j = 0; j < i; j++) {
				dp[k][i] = min(dp[k][i], dp[k - 1][j] | (sum[i] - sum[j]));
			}
		}
	}
	ll Min = 1e18;
	for(int i = a-1; i < b; i++) 
		Min = min(Min, dp[i][n]); 

	cout << Min << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33436 KB Output is correct
2 Incorrect 0 ms 33436 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33436 KB Output is correct
2 Incorrect 0 ms 33436 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33436 KB Output is correct
2 Incorrect 0 ms 33436 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33436 KB Output is correct
2 Incorrect 0 ms 33436 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33436 KB Output is correct
2 Incorrect 0 ms 33436 KB Output isn't correct
3 Halted 0 ms 0 KB -