Submission #279628

# Submission time Handle Problem Language Result Execution time Memory
279628 2020-08-22T08:30:41 Z srvlt Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) begin(x), end(x)
#define SZ(x) (int)(x).size()
#define cps(x) sort(all(x)), (x).erase(unique(all(x)), end(x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int n0 = 103;
int n, a, b;
ll dp[n0][n0], v[n0], p[n0];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++) {
		cin >> v[i];
		p[i] = p[i - 1] + v[i];
	}
	memset(& dp, 0x3f, sizeof(dp));
	ll res = dp[0][0];
	dp[0][0] = 0;
	for (int i = 1; i <= b; i++) {
		for (int j = i; j <= n; j++) {
			for (int k = j - 1; k >= 0; k--) {
				dp[i][j] = min(dp[i][j], dp[i - 1][k] | (p[j] - p[k]));
			}
		}
	}
	for (int i = a; i <= b; i++)
		res = min(res, dp[i][n]);
	cout << res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -