Submission #341841

# Submission time Handle Problem Language Result Execution time Memory
341841 2020-12-31T07:13:56 Z egod1537 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
19 ms 31872 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll INF = 1000000000LL * 2001LL;

int n, a, b;
ll arr[2001];
ll dp[2001][2001];

ll solve(int pos, int cnt) {
	if (pos == n) {
		if (a <= cnt && cnt <= b) return 0;
		else return INF;
	}

	ll& ret = dp[pos][cnt];
	if (ret != -1) return ret;

	ret = INF;
	ll sum = 0;
	for (int i = pos; i < n; i++) {
		sum += arr[i];
		ret = min(ret, solve(i+1, cnt+1)|sum);
	}

	return ret;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) cin >> arr[i];
	memset(dp, -1, sizeof(dp));

	cout << solve(0, 0);

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 19 ms 31724 KB Output is correct
2 Correct 17 ms 31724 KB Output is correct
3 Correct 18 ms 31724 KB Output is correct
4 Correct 18 ms 31724 KB Output is correct
5 Correct 17 ms 31724 KB Output is correct
6 Correct 17 ms 31724 KB Output is correct
7 Correct 17 ms 31724 KB Output is correct
8 Correct 17 ms 31724 KB Output is correct
9 Correct 18 ms 31724 KB Output is correct
10 Correct 17 ms 31724 KB Output is correct
11 Correct 17 ms 31724 KB Output is correct
12 Correct 17 ms 31724 KB Output is correct
13 Correct 17 ms 31724 KB Output is correct
14 Correct 17 ms 31724 KB Output is correct
15 Correct 17 ms 31724 KB Output is correct
16 Correct 17 ms 31724 KB Output is correct
17 Correct 17 ms 31724 KB Output is correct
18 Correct 18 ms 31724 KB Output is correct
19 Correct 17 ms 31724 KB Output is correct
20 Correct 18 ms 31724 KB Output is correct
21 Incorrect 17 ms 31724 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 31724 KB Output is correct
2 Correct 17 ms 31724 KB Output is correct
3 Correct 17 ms 31724 KB Output is correct
4 Correct 17 ms 31724 KB Output is correct
5 Correct 19 ms 31732 KB Output is correct
6 Correct 18 ms 31724 KB Output is correct
7 Correct 17 ms 31724 KB Output is correct
8 Correct 17 ms 31724 KB Output is correct
9 Correct 17 ms 31724 KB Output is correct
10 Correct 17 ms 31724 KB Output is correct
11 Correct 18 ms 31724 KB Output is correct
12 Correct 18 ms 31724 KB Output is correct
13 Correct 17 ms 31724 KB Output is correct
14 Correct 18 ms 31724 KB Output is correct
15 Correct 17 ms 31724 KB Output is correct
16 Correct 17 ms 31724 KB Output is correct
17 Correct 17 ms 31724 KB Output is correct
18 Correct 17 ms 31724 KB Output is correct
19 Correct 17 ms 31724 KB Output is correct
20 Correct 17 ms 31724 KB Output is correct
21 Incorrect 17 ms 31724 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 31724 KB Output is correct
2 Correct 16 ms 31724 KB Output is correct
3 Correct 17 ms 31724 KB Output is correct
4 Correct 17 ms 31724 KB Output is correct
5 Correct 17 ms 31724 KB Output is correct
6 Correct 17 ms 31724 KB Output is correct
7 Correct 17 ms 31724 KB Output is correct
8 Correct 18 ms 31724 KB Output is correct
9 Correct 18 ms 31724 KB Output is correct
10 Correct 17 ms 31724 KB Output is correct
11 Correct 17 ms 31724 KB Output is correct
12 Correct 18 ms 31724 KB Output is correct
13 Correct 17 ms 31724 KB Output is correct
14 Correct 18 ms 31724 KB Output is correct
15 Correct 18 ms 31724 KB Output is correct
16 Correct 17 ms 31724 KB Output is correct
17 Correct 17 ms 31724 KB Output is correct
18 Correct 17 ms 31724 KB Output is correct
19 Correct 19 ms 31724 KB Output is correct
20 Correct 18 ms 31724 KB Output is correct
21 Correct 17 ms 31724 KB Output is correct
22 Correct 18 ms 31724 KB Output is correct
23 Correct 17 ms 31724 KB Output is correct
24 Correct 17 ms 31724 KB Output is correct
25 Correct 18 ms 31724 KB Output is correct
26 Correct 18 ms 31724 KB Output is correct
27 Correct 18 ms 31724 KB Output is correct
28 Correct 18 ms 31724 KB Output is correct
29 Correct 19 ms 31724 KB Output is correct
30 Correct 19 ms 31724 KB Output is correct
31 Correct 18 ms 31724 KB Output is correct
32 Correct 18 ms 31724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 31724 KB Output is correct
2 Correct 17 ms 31724 KB Output is correct
3 Correct 18 ms 31724 KB Output is correct
4 Correct 17 ms 31724 KB Output is correct
5 Correct 18 ms 31724 KB Output is correct
6 Correct 17 ms 31724 KB Output is correct
7 Correct 18 ms 31724 KB Output is correct
8 Correct 18 ms 31724 KB Output is correct
9 Correct 17 ms 31724 KB Output is correct
10 Correct 18 ms 31724 KB Output is correct
11 Correct 18 ms 31724 KB Output is correct
12 Correct 17 ms 31724 KB Output is correct
13 Correct 17 ms 31724 KB Output is correct
14 Correct 17 ms 31724 KB Output is correct
15 Correct 18 ms 31872 KB Output is correct
16 Correct 18 ms 31724 KB Output is correct
17 Correct 17 ms 31724 KB Output is correct
18 Correct 17 ms 31724 KB Output is correct
19 Correct 17 ms 31724 KB Output is correct
20 Correct 18 ms 31724 KB Output is correct
21 Incorrect 17 ms 31724 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 31724 KB Output is correct
2 Correct 17 ms 31724 KB Output is correct
3 Correct 17 ms 31724 KB Output is correct
4 Correct 17 ms 31724 KB Output is correct
5 Correct 17 ms 31724 KB Output is correct
6 Correct 18 ms 31724 KB Output is correct
7 Correct 18 ms 31724 KB Output is correct
8 Correct 17 ms 31724 KB Output is correct
9 Correct 17 ms 31724 KB Output is correct
10 Correct 17 ms 31724 KB Output is correct
11 Correct 17 ms 31724 KB Output is correct
12 Correct 17 ms 31724 KB Output is correct
13 Correct 17 ms 31724 KB Output is correct
14 Correct 17 ms 31724 KB Output is correct
15 Correct 17 ms 31724 KB Output is correct
16 Correct 17 ms 31724 KB Output is correct
17 Correct 17 ms 31724 KB Output is correct
18 Incorrect 17 ms 31724 KB Output isn't correct
19 Halted 0 ms 0 KB -