Submission #401206

# Submission time Handle Problem Language Result Execution time Memory
401206 2021-05-09T15:20:03 Z Azimjon Bali Sculptures (APIO15_sculpture) C++17
0 / 100
23 ms 35196 KB
// Muallif: Azimjon Mehmonali o'g'li

#include <bits/stdc++.h>

using namespace std;

#define int long long

const long double PI = 3.1415926535897;
const int mod = 1000000007LL;
const int INF = 1e18;
const int N = 2111;
const int K = 2111;

int n, k;
int y[N], p[N], dp[K][N], pa[K][N];

signed 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 >> y[i];

		p[i] = p[i - 1] + y[i];
	}

	for (int i = 1; i < N; i++) {
		for (int j = 0; j < N; j++) {
			dp[i][j] = INF;
		}
	}
	for (int i = 1; i <= n; i++)
		dp[0][i] = p[i];

	for (int k = 1; k <= n; k++) {
		for (int i = k; i <= n; i++) {
			for (int j = 1; j < i; j++) {
				dp[k][i] = min(dp[k][i], dp[k - 1][j] | ((p[i] - p[j])));
			}
		}
	}

	int jv = INF;

	for (int i = a - 1; i < b; i++) {
		jv = min(jv, dp[i][n]);
	}

	cout << jv << endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 23 ms 35192 KB Output is correct
2 Incorrect 22 ms 35148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 35148 KB Output is correct
2 Incorrect 20 ms 35148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 35196 KB Output is correct
2 Incorrect 19 ms 35148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 35152 KB Output is correct
2 Incorrect 20 ms 35116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 35132 KB Output is correct
2 Incorrect 20 ms 35140 KB Output isn't correct
3 Halted 0 ms 0 KB -