Submission #48154

# Submission time Handle Problem Language Result Execution time Memory
48154 2018-05-10T10:58:11 Z square1001 Bali Sculptures (APIO15_sculpture) C++14
100 / 100
601 ms 1160 KB
#include <bitset>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	vector<int> v(N);
	for (int i = 0; i < N; i++) cin >> v[i];
	long long ret = 0;
	for (int i = 40; i >= 0; i--) {
		vector<bitset<2001> > dp(N + 1);
		dp[0] = 1;
		for (int j = 1; j <= N; j++) {
			long long cur = 0;
			for (int k = j - 1; k >= 0; k--) {
				cur += v[k];
				if (((cur >> (i + 1)) | ret) == ret && !((cur >> i) & 1)) {
					dp[j] |= dp[k] << 1;
				}
			}
		}
		bool ok = false;
		for (int j = A; j <= B; j++) {
			ok = ok || dp[N][j];
		}
		ret <<= 1;
		if (!ok) ret++;
	}
	cout << ret << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 632 KB Output is correct
4 Correct 2 ms 632 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 632 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 632 KB Output is correct
11 Correct 2 ms 632 KB Output is correct
12 Correct 3 ms 632 KB Output is correct
13 Correct 2 ms 632 KB Output is correct
14 Correct 2 ms 632 KB Output is correct
15 Correct 2 ms 632 KB Output is correct
16 Correct 2 ms 632 KB Output is correct
17 Correct 2 ms 632 KB Output is correct
18 Correct 2 ms 632 KB Output is correct
19 Correct 2 ms 632 KB Output is correct
20 Correct 2 ms 632 KB Output is correct
21 Correct 2 ms 632 KB Output is correct
22 Correct 2 ms 632 KB Output is correct
23 Correct 2 ms 632 KB Output is correct
24 Correct 3 ms 632 KB Output is correct
25 Correct 2 ms 632 KB Output is correct
26 Correct 3 ms 632 KB Output is correct
27 Correct 2 ms 632 KB Output is correct
28 Correct 2 ms 632 KB Output is correct
29 Correct 2 ms 632 KB Output is correct
30 Correct 2 ms 632 KB Output is correct
31 Correct 2 ms 632 KB Output is correct
32 Correct 2 ms 632 KB Output is correct
33 Correct 2 ms 632 KB Output is correct
34 Correct 2 ms 632 KB Output is correct
35 Correct 2 ms 632 KB Output is correct
36 Correct 2 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 632 KB Output is correct
2 Correct 2 ms 632 KB Output is correct
3 Correct 2 ms 632 KB Output is correct
4 Correct 2 ms 632 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 632 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 3 ms 632 KB Output is correct
10 Correct 2 ms 632 KB Output is correct
11 Correct 2 ms 632 KB Output is correct
12 Correct 2 ms 632 KB Output is correct
13 Correct 2 ms 632 KB Output is correct
14 Correct 2 ms 632 KB Output is correct
15 Correct 2 ms 632 KB Output is correct
16 Correct 2 ms 632 KB Output is correct
17 Correct 2 ms 632 KB Output is correct
18 Correct 2 ms 632 KB Output is correct
19 Correct 2 ms 632 KB Output is correct
20 Correct 2 ms 632 KB Output is correct
21 Correct 3 ms 632 KB Output is correct
22 Correct 2 ms 632 KB Output is correct
23 Correct 3 ms 632 KB Output is correct
24 Correct 2 ms 632 KB Output is correct
25 Correct 2 ms 632 KB Output is correct
26 Correct 2 ms 632 KB Output is correct
27 Correct 3 ms 632 KB Output is correct
28 Correct 3 ms 632 KB Output is correct
29 Correct 4 ms 632 KB Output is correct
30 Correct 4 ms 632 KB Output is correct
31 Correct 5 ms 632 KB Output is correct
32 Correct 6 ms 636 KB Output is correct
33 Correct 6 ms 636 KB Output is correct
34 Correct 5 ms 636 KB Output is correct
35 Correct 5 ms 636 KB Output is correct
36 Correct 5 ms 636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 636 KB Output is correct
2 Correct 2 ms 636 KB Output is correct
3 Correct 2 ms 636 KB Output is correct
4 Correct 2 ms 636 KB Output is correct
5 Correct 2 ms 636 KB Output is correct
6 Correct 2 ms 636 KB Output is correct
7 Correct 2 ms 636 KB Output is correct
8 Correct 2 ms 636 KB Output is correct
9 Correct 2 ms 636 KB Output is correct
10 Correct 3 ms 636 KB Output is correct
11 Correct 2 ms 636 KB Output is correct
12 Correct 2 ms 636 KB Output is correct
13 Correct 2 ms 636 KB Output is correct
14 Correct 2 ms 636 KB Output is correct
15 Correct 3 ms 636 KB Output is correct
16 Correct 4 ms 636 KB Output is correct
17 Correct 4 ms 636 KB Output is correct
18 Correct 5 ms 636 KB Output is correct
19 Correct 5 ms 636 KB Output is correct
20 Correct 5 ms 636 KB Output is correct
21 Correct 5 ms 636 KB Output is correct
22 Correct 5 ms 636 KB Output is correct
23 Correct 5 ms 636 KB Output is correct
24 Correct 5 ms 636 KB Output is correct
25 Correct 7 ms 636 KB Output is correct
26 Correct 9 ms 636 KB Output is correct
27 Correct 11 ms 636 KB Output is correct
28 Correct 13 ms 636 KB Output is correct
29 Correct 13 ms 636 KB Output is correct
30 Correct 14 ms 760 KB Output is correct
31 Correct 13 ms 760 KB Output is correct
32 Correct 13 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 760 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 760 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 2 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 2 ms 760 KB Output is correct
14 Correct 2 ms 760 KB Output is correct
15 Correct 2 ms 760 KB Output is correct
16 Correct 2 ms 760 KB Output is correct
17 Correct 2 ms 760 KB Output is correct
18 Correct 2 ms 760 KB Output is correct
19 Correct 2 ms 760 KB Output is correct
20 Correct 2 ms 760 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 760 KB Output is correct
23 Correct 2 ms 760 KB Output is correct
24 Correct 2 ms 760 KB Output is correct
25 Correct 2 ms 760 KB Output is correct
26 Correct 2 ms 760 KB Output is correct
27 Correct 2 ms 760 KB Output is correct
28 Correct 2 ms 760 KB Output is correct
29 Correct 2 ms 760 KB Output is correct
30 Correct 2 ms 760 KB Output is correct
31 Correct 2 ms 760 KB Output is correct
32 Correct 2 ms 760 KB Output is correct
33 Correct 2 ms 760 KB Output is correct
34 Correct 2 ms 760 KB Output is correct
35 Correct 2 ms 760 KB Output is correct
36 Correct 2 ms 760 KB Output is correct
37 Correct 2 ms 760 KB Output is correct
38 Correct 3 ms 760 KB Output is correct
39 Correct 4 ms 760 KB Output is correct
40 Correct 4 ms 760 KB Output is correct
41 Correct 5 ms 760 KB Output is correct
42 Correct 5 ms 760 KB Output is correct
43 Correct 5 ms 760 KB Output is correct
44 Correct 5 ms 760 KB Output is correct
45 Correct 5 ms 760 KB Output is correct
46 Correct 5 ms 760 KB Output is correct
47 Correct 5 ms 760 KB Output is correct
48 Correct 7 ms 760 KB Output is correct
49 Correct 9 ms 760 KB Output is correct
50 Correct 12 ms 760 KB Output is correct
51 Correct 16 ms 760 KB Output is correct
52 Correct 12 ms 760 KB Output is correct
53 Correct 14 ms 760 KB Output is correct
54 Correct 13 ms 760 KB Output is correct
55 Correct 13 ms 764 KB Output is correct
56 Correct 3 ms 764 KB Output is correct
57 Correct 4 ms 764 KB Output is correct
58 Correct 4 ms 764 KB Output is correct
59 Correct 5 ms 764 KB Output is correct
60 Correct 5 ms 764 KB Output is correct
61 Correct 5 ms 764 KB Output is correct
62 Correct 6 ms 764 KB Output is correct
63 Correct 7 ms 764 KB Output is correct
64 Correct 13 ms 764 KB Output is correct
65 Correct 3 ms 764 KB Output is correct
66 Correct 4 ms 764 KB Output is correct
67 Correct 4 ms 764 KB Output is correct
68 Correct 5 ms 764 KB Output is correct
69 Correct 6 ms 764 KB Output is correct
70 Correct 4 ms 764 KB Output is correct
71 Correct 5 ms 764 KB Output is correct
72 Correct 7 ms 764 KB Output is correct
73 Correct 7 ms 764 KB Output is correct
74 Correct 6 ms 764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 764 KB Output is correct
2 Correct 2 ms 764 KB Output is correct
3 Correct 2 ms 764 KB Output is correct
4 Correct 2 ms 764 KB Output is correct
5 Correct 2 ms 764 KB Output is correct
6 Correct 3 ms 764 KB Output is correct
7 Correct 2 ms 764 KB Output is correct
8 Correct 2 ms 764 KB Output is correct
9 Correct 2 ms 764 KB Output is correct
10 Correct 2 ms 764 KB Output is correct
11 Correct 2 ms 764 KB Output is correct
12 Correct 2 ms 764 KB Output is correct
13 Correct 2 ms 764 KB Output is correct
14 Correct 2 ms 764 KB Output is correct
15 Correct 2 ms 764 KB Output is correct
16 Correct 2 ms 764 KB Output is correct
17 Correct 2 ms 764 KB Output is correct
18 Correct 2 ms 764 KB Output is correct
19 Correct 2 ms 764 KB Output is correct
20 Correct 2 ms 764 KB Output is correct
21 Correct 2 ms 764 KB Output is correct
22 Correct 2 ms 764 KB Output is correct
23 Correct 2 ms 764 KB Output is correct
24 Correct 2 ms 764 KB Output is correct
25 Correct 3 ms 764 KB Output is correct
26 Correct 3 ms 764 KB Output is correct
27 Correct 4 ms 764 KB Output is correct
28 Correct 5 ms 764 KB Output is correct
29 Correct 5 ms 764 KB Output is correct
30 Correct 6 ms 764 KB Output is correct
31 Correct 5 ms 764 KB Output is correct
32 Correct 5 ms 764 KB Output is correct
33 Correct 5 ms 764 KB Output is correct
34 Correct 5 ms 764 KB Output is correct
35 Correct 7 ms 764 KB Output is correct
36 Correct 9 ms 764 KB Output is correct
37 Correct 11 ms 764 KB Output is correct
38 Correct 13 ms 764 KB Output is correct
39 Correct 14 ms 764 KB Output is correct
40 Correct 14 ms 764 KB Output is correct
41 Correct 13 ms 764 KB Output is correct
42 Correct 13 ms 764 KB Output is correct
43 Correct 3 ms 764 KB Output is correct
44 Correct 4 ms 764 KB Output is correct
45 Correct 4 ms 764 KB Output is correct
46 Correct 5 ms 764 KB Output is correct
47 Correct 4 ms 764 KB Output is correct
48 Correct 5 ms 764 KB Output is correct
49 Correct 6 ms 764 KB Output is correct
50 Correct 6 ms 764 KB Output is correct
51 Correct 5 ms 764 KB Output is correct
52 Correct 69 ms 848 KB Output is correct
53 Correct 101 ms 848 KB Output is correct
54 Correct 188 ms 916 KB Output is correct
55 Correct 179 ms 916 KB Output is correct
56 Correct 520 ms 1152 KB Output is correct
57 Correct 496 ms 1152 KB Output is correct
58 Correct 370 ms 1152 KB Output is correct
59 Correct 365 ms 1160 KB Output is correct
60 Correct 601 ms 1160 KB Output is correct
61 Correct 7 ms 1160 KB Output is correct
62 Correct 104 ms 1160 KB Output is correct
63 Correct 186 ms 1160 KB Output is correct
64 Correct 154 ms 1160 KB Output is correct
65 Correct 262 ms 1160 KB Output is correct
66 Correct 356 ms 1160 KB Output is correct
67 Correct 494 ms 1160 KB Output is correct
68 Correct 492 ms 1160 KB Output is correct
69 Correct 430 ms 1160 KB Output is correct