답안 #83451

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
83451 2018-11-07T20:09:33 Z Qlukva Bali Sculptures (APIO15_sculpture) C++14
71 / 100
1000 ms 13180 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;

const long long INF = 1e15;
const int MAX = 70;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, a, b;
	cin >> n >> a >> b;
	vector<long long> x(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	vector<vector<set<long long>>> d(b + 1, vector<set<long long>>(n + 1));
	d[0][0].insert(0);
	for (int j = 1; j <= b; j++) {
		for (int i = 1; i <= n; i++) {
			long long cur = x[i];
			for (int k = i - 1; k >= 0; k--) {
				for (auto &x : d[j - 1][k]) {
					d[j][i].insert(cur | x);
				}
				while (d[j][i].size() > MAX) {
					d[j][i].erase(--d[j][i].end());
				}
				cur += x[k];
			}
		}
	}
	long long ans = INF;
	for (int i = a; i <= b; i++) {
		ans = min(ans, *d[i][n].begin());
	}
	cout << ans << endl;
//	system("pause");
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 2 ms 552 KB Output is correct
13 Correct 2 ms 552 KB Output is correct
14 Correct 2 ms 552 KB Output is correct
15 Correct 2 ms 552 KB Output is correct
16 Correct 2 ms 552 KB Output is correct
17 Correct 2 ms 552 KB Output is correct
18 Correct 2 ms 552 KB Output is correct
19 Correct 2 ms 552 KB Output is correct
20 Correct 2 ms 552 KB Output is correct
21 Correct 3 ms 556 KB Output is correct
22 Correct 3 ms 556 KB Output is correct
23 Correct 2 ms 556 KB Output is correct
24 Correct 2 ms 592 KB Output is correct
25 Correct 2 ms 592 KB Output is correct
26 Correct 2 ms 592 KB Output is correct
27 Correct 2 ms 592 KB Output is correct
28 Correct 2 ms 592 KB Output is correct
29 Correct 2 ms 592 KB Output is correct
30 Correct 2 ms 592 KB Output is correct
31 Correct 2 ms 712 KB Output is correct
32 Correct 2 ms 712 KB Output is correct
33 Correct 2 ms 712 KB Output is correct
34 Correct 2 ms 712 KB Output is correct
35 Correct 2 ms 712 KB Output is correct
36 Correct 2 ms 712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 712 KB Output is correct
2 Correct 2 ms 748 KB Output is correct
3 Correct 2 ms 748 KB Output is correct
4 Correct 2 ms 748 KB Output is correct
5 Correct 2 ms 748 KB Output is correct
6 Correct 2 ms 748 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 2 ms 748 KB Output is correct
10 Correct 2 ms 748 KB Output is correct
11 Correct 2 ms 748 KB Output is correct
12 Correct 2 ms 748 KB Output is correct
13 Correct 2 ms 748 KB Output is correct
14 Correct 2 ms 748 KB Output is correct
15 Correct 2 ms 748 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 2 ms 748 KB Output is correct
19 Correct 2 ms 748 KB Output is correct
20 Correct 2 ms 748 KB Output is correct
21 Correct 2 ms 748 KB Output is correct
22 Correct 2 ms 748 KB Output is correct
23 Correct 2 ms 748 KB Output is correct
24 Correct 2 ms 748 KB Output is correct
25 Correct 2 ms 748 KB Output is correct
26 Correct 2 ms 748 KB Output is correct
27 Correct 2 ms 748 KB Output is correct
28 Correct 3 ms 764 KB Output is correct
29 Correct 3 ms 764 KB Output is correct
30 Correct 9 ms 1152 KB Output is correct
31 Correct 22 ms 1788 KB Output is correct
32 Correct 10 ms 1788 KB Output is correct
33 Correct 2 ms 1788 KB Output is correct
34 Correct 15 ms 1788 KB Output is correct
35 Correct 13 ms 1788 KB Output is correct
36 Correct 15 ms 1788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1788 KB Output is correct
2 Correct 2 ms 1788 KB Output is correct
3 Correct 2 ms 1788 KB Output is correct
4 Correct 2 ms 1788 KB Output is correct
5 Correct 2 ms 1788 KB Output is correct
6 Correct 3 ms 1788 KB Output is correct
7 Correct 2 ms 1788 KB Output is correct
8 Correct 2 ms 1788 KB Output is correct
9 Correct 2 ms 1788 KB Output is correct
10 Correct 2 ms 1788 KB Output is correct
11 Correct 2 ms 1788 KB Output is correct
12 Correct 3 ms 1788 KB Output is correct
13 Correct 3 ms 1788 KB Output is correct
14 Correct 2 ms 1788 KB Output is correct
15 Correct 3 ms 1788 KB Output is correct
16 Correct 3 ms 1788 KB Output is correct
17 Correct 12 ms 1788 KB Output is correct
18 Correct 21 ms 1788 KB Output is correct
19 Correct 13 ms 1788 KB Output is correct
20 Correct 2 ms 1788 KB Output is correct
21 Correct 15 ms 1788 KB Output is correct
22 Correct 14 ms 1788 KB Output is correct
23 Correct 13 ms 1788 KB Output is correct
24 Correct 25 ms 1788 KB Output is correct
25 Correct 34 ms 1788 KB Output is correct
26 Correct 111 ms 3772 KB Output is correct
27 Correct 223 ms 6780 KB Output is correct
28 Correct 297 ms 8700 KB Output is correct
29 Correct 205 ms 8700 KB Output is correct
30 Correct 2 ms 8700 KB Output is correct
31 Correct 305 ms 8700 KB Output is correct
32 Correct 333 ms 9140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 9140 KB Output is correct
2 Correct 2 ms 9140 KB Output is correct
3 Correct 2 ms 9140 KB Output is correct
4 Correct 2 ms 9140 KB Output is correct
5 Correct 2 ms 9140 KB Output is correct
6 Correct 2 ms 9140 KB Output is correct
7 Correct 2 ms 9140 KB Output is correct
8 Correct 2 ms 9140 KB Output is correct
9 Correct 2 ms 9140 KB Output is correct
10 Correct 2 ms 9140 KB Output is correct
11 Correct 2 ms 9140 KB Output is correct
12 Correct 2 ms 9140 KB Output is correct
13 Correct 2 ms 9140 KB Output is correct
14 Correct 2 ms 9140 KB Output is correct
15 Correct 2 ms 9140 KB Output is correct
16 Correct 2 ms 9140 KB Output is correct
17 Correct 2 ms 9140 KB Output is correct
18 Correct 2 ms 9140 KB Output is correct
19 Correct 2 ms 9140 KB Output is correct
20 Correct 2 ms 9140 KB Output is correct
21 Correct 2 ms 9140 KB Output is correct
22 Correct 2 ms 9140 KB Output is correct
23 Correct 2 ms 9140 KB Output is correct
24 Correct 2 ms 9140 KB Output is correct
25 Correct 2 ms 9140 KB Output is correct
26 Correct 3 ms 9140 KB Output is correct
27 Correct 2 ms 9140 KB Output is correct
28 Correct 2 ms 9140 KB Output is correct
29 Correct 2 ms 9140 KB Output is correct
30 Correct 2 ms 9140 KB Output is correct
31 Correct 2 ms 9140 KB Output is correct
32 Correct 2 ms 9140 KB Output is correct
33 Correct 2 ms 9140 KB Output is correct
34 Correct 2 ms 9140 KB Output is correct
35 Correct 2 ms 9140 KB Output is correct
36 Correct 2 ms 9140 KB Output is correct
37 Correct 2 ms 9140 KB Output is correct
38 Correct 3 ms 9140 KB Output is correct
39 Correct 3 ms 9140 KB Output is correct
40 Correct 9 ms 9140 KB Output is correct
41 Correct 22 ms 9140 KB Output is correct
42 Correct 11 ms 9140 KB Output is correct
43 Correct 2 ms 9140 KB Output is correct
44 Correct 15 ms 9140 KB Output is correct
45 Correct 13 ms 9140 KB Output is correct
46 Correct 12 ms 9140 KB Output is correct
47 Correct 24 ms 9140 KB Output is correct
48 Correct 33 ms 9140 KB Output is correct
49 Correct 111 ms 9140 KB Output is correct
50 Correct 205 ms 9140 KB Output is correct
51 Correct 300 ms 9140 KB Output is correct
52 Correct 212 ms 9140 KB Output is correct
53 Correct 2 ms 9140 KB Output is correct
54 Correct 313 ms 9140 KB Output is correct
55 Correct 326 ms 9140 KB Output is correct
56 Correct 64 ms 9140 KB Output is correct
57 Correct 228 ms 9140 KB Output is correct
58 Correct 437 ms 9140 KB Output is correct
59 Correct 582 ms 10900 KB Output is correct
60 Correct 659 ms 13052 KB Output is correct
61 Correct 2 ms 13052 KB Output is correct
62 Correct 679 ms 13052 KB Output is correct
63 Correct 657 ms 13052 KB Output is correct
64 Correct 50 ms 13052 KB Output is correct
65 Correct 66 ms 13052 KB Output is correct
66 Correct 82 ms 13052 KB Output is correct
67 Correct 232 ms 13052 KB Output is correct
68 Correct 424 ms 13052 KB Output is correct
69 Correct 596 ms 13052 KB Output is correct
70 Correct 657 ms 13180 KB Output is correct
71 Correct 2 ms 13180 KB Output is correct
72 Correct 647 ms 13180 KB Output is correct
73 Correct 672 ms 13180 KB Output is correct
74 Correct 659 ms 13180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 13180 KB Output is correct
2 Correct 2 ms 13180 KB Output is correct
3 Correct 2 ms 13180 KB Output is correct
4 Correct 2 ms 13180 KB Output is correct
5 Correct 2 ms 13180 KB Output is correct
6 Correct 2 ms 13180 KB Output is correct
7 Correct 3 ms 13180 KB Output is correct
8 Correct 2 ms 13180 KB Output is correct
9 Correct 2 ms 13180 KB Output is correct
10 Correct 2 ms 13180 KB Output is correct
11 Correct 2 ms 13180 KB Output is correct
12 Correct 2 ms 13180 KB Output is correct
13 Correct 2 ms 13180 KB Output is correct
14 Correct 2 ms 13180 KB Output is correct
15 Correct 2 ms 13180 KB Output is correct
16 Correct 2 ms 13180 KB Output is correct
17 Correct 2 ms 13180 KB Output is correct
18 Correct 2 ms 13180 KB Output is correct
19 Correct 2 ms 13180 KB Output is correct
20 Correct 2 ms 13180 KB Output is correct
21 Correct 2 ms 13180 KB Output is correct
22 Correct 2 ms 13180 KB Output is correct
23 Correct 2 ms 13180 KB Output is correct
24 Correct 2 ms 13180 KB Output is correct
25 Correct 3 ms 13180 KB Output is correct
26 Correct 3 ms 13180 KB Output is correct
27 Correct 9 ms 13180 KB Output is correct
28 Correct 22 ms 13180 KB Output is correct
29 Correct 11 ms 13180 KB Output is correct
30 Correct 2 ms 13180 KB Output is correct
31 Correct 17 ms 13180 KB Output is correct
32 Correct 14 ms 13180 KB Output is correct
33 Correct 12 ms 13180 KB Output is correct
34 Correct 25 ms 13180 KB Output is correct
35 Correct 35 ms 13180 KB Output is correct
36 Correct 115 ms 13180 KB Output is correct
37 Correct 213 ms 13180 KB Output is correct
38 Correct 300 ms 13180 KB Output is correct
39 Correct 209 ms 13180 KB Output is correct
40 Correct 2 ms 13180 KB Output is correct
41 Correct 305 ms 13180 KB Output is correct
42 Correct 349 ms 13180 KB Output is correct
43 Correct 63 ms 13180 KB Output is correct
44 Correct 234 ms 13180 KB Output is correct
45 Correct 436 ms 13180 KB Output is correct
46 Correct 574 ms 13180 KB Output is correct
47 Correct 667 ms 13180 KB Output is correct
48 Correct 2 ms 13180 KB Output is correct
49 Correct 673 ms 13180 KB Output is correct
50 Correct 653 ms 13180 KB Output is correct
51 Correct 422 ms 13180 KB Output is correct
52 Execution timed out 1082 ms 13180 KB Time limit exceeded
53 Halted 0 ms 0 KB -