Submission #108227

# Submission time Handle Problem Language Result Execution time Memory
108227 2019-04-28T09:54:39 Z maksim_gaponov Bali Sculptures (APIO15_sculpture) C++14
0 / 100
487 ms 432 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll

const int INF = 1e18;

void run() {
	int n, a, b;
	cin >> n >> a >> b;
	vector<int> y(n);
	for (auto &x : y)
		cin >> x;
	int ans = INF;
	for (int mask = 0; mask < (1 << n); ++mask) {
		int cnt = __builtin_popcountll(mask) + 1;
		if (cnt < a || cnt > b)
			continue;
		int cur_ans = 0;
		int cur_sum = 0;
		for (int i = 0; i < n; ++i) {
			if (mask & (1 << i)) {
				cur_ans |= cur_sum;
				cur_sum = 0;
			}
			cur_sum += y[i];
		}
		cur_ans |= cur_sum;
		if (cur_ans < ans)
			ans = cur_ans;
	}
	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	run();
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 10 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 9 ms 384 KB Output is correct
13 Correct 84 ms 432 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 7 ms 384 KB Output is correct
10 Correct 9 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 34 ms 384 KB Output is correct
13 Correct 79 ms 376 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 256 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 9 ms 256 KB Output is correct
9 Correct 8 ms 384 KB Output is correct
10 Correct 6 ms 256 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 77 ms 384 KB Output is correct
14 Correct 167 ms 384 KB Output is correct
15 Correct 422 ms 376 KB Output is correct
16 Incorrect 2 ms 384 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 7 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 7 ms 256 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 86 ms 376 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 256 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 9 ms 384 KB Output is correct
11 Correct 7 ms 256 KB Output is correct
12 Correct 6 ms 384 KB Output is correct
13 Correct 96 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 6 ms 384 KB Output is correct
18 Correct 10 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 66 ms 376 KB Output is correct
21 Correct 81 ms 384 KB Output is correct
22 Correct 7 ms 384 KB Output is correct
23 Correct 77 ms 384 KB Output is correct
24 Correct 173 ms 376 KB Output is correct
25 Correct 487 ms 376 KB Output is correct
26 Incorrect 2 ms 384 KB Output isn't correct
27 Halted 0 ms 0 KB -