# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
45760 | 2018-04-16T05:59:37 Z | antimirage | Bali Sculptures (APIO15_sculpture) | C++17 | 1000 ms | 262144 KB |
#include <bits/stdc++.h> #define fr first #define sc second #define mk make_pair #define pb push_back #define OK puts("OK"); #define sz(s) (int)s.size() #define all(s) s.begin(), s.end() using namespace std; const int N = 2005, inf = 1e18; int n, a, b, ar[N]; long long pref[N], ans = 1e18; vector <long long> dp[N][N]; main() { cin >> n >> a >> b; for (int i = 1; i <= n; i++) scanf("%d", &ar[i]), pref[i] = ar[i] + pref[i - 1]; dp[0][0].push_back( 0 ); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= j; k++) { for (auto it : dp[i - 1][k - 1]) dp[i][j].push_back( it | (pref[j] - pref[k - 1]) ); } } } for (int i = a; i <= b; i++) { sort(all(dp[i][n])); ans = min(ans, dp[i][n][0]); } cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 79 ms | 94712 KB | Output is correct |
2 | Correct | 76 ms | 94720 KB | Output is correct |
3 | Correct | 76 ms | 94752 KB | Output is correct |
4 | Correct | 81 ms | 94796 KB | Output is correct |
5 | Correct | 85 ms | 94804 KB | Output is correct |
6 | Correct | 75 ms | 95188 KB | Output is correct |
7 | Correct | 76 ms | 96156 KB | Output is correct |
8 | Correct | 87 ms | 104144 KB | Output is correct |
9 | Correct | 86 ms | 104176 KB | Output is correct |
10 | Correct | 86 ms | 104176 KB | Output is correct |
11 | Correct | 87 ms | 104176 KB | Output is correct |
12 | Correct | 88 ms | 104176 KB | Output is correct |
13 | Correct | 98 ms | 104220 KB | Output is correct |
14 | Correct | 79 ms | 104220 KB | Output is correct |
15 | Correct | 75 ms | 104220 KB | Output is correct |
16 | Correct | 75 ms | 104220 KB | Output is correct |
17 | Correct | 75 ms | 104220 KB | Output is correct |
18 | Correct | 75 ms | 104220 KB | Output is correct |
19 | Correct | 76 ms | 104220 KB | Output is correct |
20 | Correct | 77 ms | 104220 KB | Output is correct |
21 | Correct | 86 ms | 104240 KB | Output is correct |
22 | Correct | 99 ms | 104240 KB | Output is correct |
23 | Correct | 88 ms | 104240 KB | Output is correct |
24 | Correct | 86 ms | 104352 KB | Output is correct |
25 | Correct | 89 ms | 104352 KB | Output is correct |
26 | Correct | 96 ms | 104352 KB | Output is correct |
27 | Correct | 77 ms | 104352 KB | Output is correct |
28 | Correct | 76 ms | 104352 KB | Output is correct |
29 | Correct | 76 ms | 104352 KB | Output is correct |
30 | Correct | 81 ms | 104352 KB | Output is correct |
31 | Correct | 88 ms | 104352 KB | Output is correct |
32 | Correct | 86 ms | 104352 KB | Output is correct |
33 | Correct | 94 ms | 104352 KB | Output is correct |
34 | Correct | 95 ms | 104352 KB | Output is correct |
35 | Correct | 88 ms | 104352 KB | Output is correct |
36 | Correct | 98 ms | 104368 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 75 ms | 104368 KB | Output is correct |
2 | Correct | 75 ms | 104368 KB | Output is correct |
3 | Correct | 77 ms | 104368 KB | Output is correct |
4 | Correct | 92 ms | 104368 KB | Output is correct |
5 | Correct | 78 ms | 104368 KB | Output is correct |
6 | Correct | 80 ms | 104368 KB | Output is correct |
7 | Correct | 88 ms | 104368 KB | Output is correct |
8 | Correct | 87 ms | 104368 KB | Output is correct |
9 | Correct | 87 ms | 104368 KB | Output is correct |
10 | Correct | 87 ms | 104368 KB | Output is correct |
11 | Correct | 89 ms | 104368 KB | Output is correct |
12 | Correct | 89 ms | 104368 KB | Output is correct |
13 | Correct | 98 ms | 104368 KB | Output is correct |
14 | Correct | 79 ms | 104368 KB | Output is correct |
15 | Correct | 79 ms | 104368 KB | Output is correct |
16 | Correct | 78 ms | 104368 KB | Output is correct |
17 | Correct | 76 ms | 104368 KB | Output is correct |
18 | Correct | 76 ms | 104368 KB | Output is correct |
19 | Correct | 77 ms | 104368 KB | Output is correct |
20 | Correct | 79 ms | 104368 KB | Output is correct |
21 | Correct | 92 ms | 104368 KB | Output is correct |
22 | Correct | 97 ms | 104368 KB | Output is correct |
23 | Correct | 88 ms | 104368 KB | Output is correct |
24 | Correct | 87 ms | 104368 KB | Output is correct |
25 | Correct | 87 ms | 104368 KB | Output is correct |
26 | Correct | 94 ms | 104368 KB | Output is correct |
27 | Correct | 118 ms | 113260 KB | Output is correct |
28 | Execution timed out | 1097 ms | 262144 KB | Time limit exceeded |
29 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 77 ms | 262144 KB | Output is correct |
2 | Correct | 76 ms | 262144 KB | Output is correct |
3 | Correct | 75 ms | 262144 KB | Output is correct |
4 | Correct | 75 ms | 262144 KB | Output is correct |
5 | Correct | 93 ms | 262144 KB | Output is correct |
6 | Correct | 76 ms | 262144 KB | Output is correct |
7 | Correct | 76 ms | 262144 KB | Output is correct |
8 | Correct | 86 ms | 262144 KB | Output is correct |
9 | Correct | 88 ms | 262144 KB | Output is correct |
10 | Correct | 86 ms | 262144 KB | Output is correct |
11 | Correct | 87 ms | 262144 KB | Output is correct |
12 | Correct | 90 ms | 262144 KB | Output is correct |
13 | Correct | 97 ms | 262144 KB | Output is correct |
14 | Correct | 114 ms | 262144 KB | Output is correct |
15 | Execution timed out | 1111 ms | 262144 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 76 ms | 262144 KB | Output is correct |
2 | Correct | 75 ms | 262144 KB | Output is correct |
3 | Correct | 75 ms | 262144 KB | Output is correct |
4 | Correct | 76 ms | 262144 KB | Output is correct |
5 | Correct | 74 ms | 262144 KB | Output is correct |
6 | Correct | 78 ms | 262144 KB | Output is correct |
7 | Correct | 77 ms | 262144 KB | Output is correct |
8 | Correct | 88 ms | 262144 KB | Output is correct |
9 | Correct | 102 ms | 262144 KB | Output is correct |
10 | Correct | 86 ms | 262144 KB | Output is correct |
11 | Correct | 86 ms | 262144 KB | Output is correct |
12 | Correct | 88 ms | 262144 KB | Output is correct |
13 | Correct | 95 ms | 262144 KB | Output is correct |
14 | Correct | 75 ms | 262144 KB | Output is correct |
15 | Correct | 81 ms | 262144 KB | Output is correct |
16 | Correct | 75 ms | 262144 KB | Output is correct |
17 | Correct | 77 ms | 262144 KB | Output is correct |
18 | Correct | 76 ms | 262144 KB | Output is correct |
19 | Correct | 75 ms | 262144 KB | Output is correct |
20 | Correct | 76 ms | 262144 KB | Output is correct |
21 | Correct | 100 ms | 262144 KB | Output is correct |
22 | Correct | 86 ms | 262144 KB | Output is correct |
23 | Correct | 86 ms | 262144 KB | Output is correct |
24 | Correct | 86 ms | 262144 KB | Output is correct |
25 | Correct | 89 ms | 262144 KB | Output is correct |
26 | Correct | 95 ms | 262144 KB | Output is correct |
27 | Correct | 76 ms | 262144 KB | Output is correct |
28 | Correct | 77 ms | 262144 KB | Output is correct |
29 | Correct | 91 ms | 262144 KB | Output is correct |
30 | Correct | 81 ms | 262144 KB | Output is correct |
31 | Correct | 87 ms | 262144 KB | Output is correct |
32 | Correct | 85 ms | 262144 KB | Output is correct |
33 | Correct | 96 ms | 262144 KB | Output is correct |
34 | Correct | 95 ms | 262144 KB | Output is correct |
35 | Correct | 93 ms | 262144 KB | Output is correct |
36 | Correct | 94 ms | 262144 KB | Output is correct |
37 | Correct | 115 ms | 262144 KB | Output is correct |
38 | Execution timed out | 1094 ms | 262144 KB | Time limit exceeded |
39 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 78 ms | 262144 KB | Output is correct |
2 | Correct | 75 ms | 262144 KB | Output is correct |
3 | Correct | 76 ms | 262144 KB | Output is correct |
4 | Correct | 76 ms | 262144 KB | Output is correct |
5 | Correct | 92 ms | 262144 KB | Output is correct |
6 | Correct | 92 ms | 262144 KB | Output is correct |
7 | Correct | 81 ms | 262144 KB | Output is correct |
8 | Correct | 108 ms | 262144 KB | Output is correct |
9 | Correct | 97 ms | 262144 KB | Output is correct |
10 | Correct | 102 ms | 262144 KB | Output is correct |
11 | Correct | 113 ms | 262144 KB | Output is correct |
12 | Correct | 111 ms | 262144 KB | Output is correct |
13 | Correct | 109 ms | 262144 KB | Output is correct |
14 | Correct | 84 ms | 262144 KB | Output is correct |
15 | Correct | 83 ms | 262144 KB | Output is correct |
16 | Correct | 84 ms | 262144 KB | Output is correct |
17 | Correct | 108 ms | 262144 KB | Output is correct |
18 | Correct | 97 ms | 262144 KB | Output is correct |
19 | Correct | 92 ms | 262144 KB | Output is correct |
20 | Correct | 100 ms | 262144 KB | Output is correct |
21 | Correct | 103 ms | 262144 KB | Output is correct |
22 | Correct | 95 ms | 262144 KB | Output is correct |
23 | Correct | 103 ms | 262144 KB | Output is correct |
24 | Correct | 123 ms | 262144 KB | Output is correct |
25 | Execution timed out | 1097 ms | 262144 KB | Time limit exceeded |
26 | Halted | 0 ms | 0 KB | - |