#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2005;
int n, x, y;
ll a[N];
vector<ll> dp[N][N];
int main(){
cin >> n >> x >> y;
for (int i = 1; i <= n; i ++)
cin >> a[i], a[i] += a[i - 1], dp[i][1] = {a[i]};
for (int j = 2; j <= n; j ++){
for (int i = j; i <= n; i ++){
for (int k = j - 1; k < i; k ++){
for (int val : dp[k][j - 1]){
dp[i][j].push_back(val | (a[i] - a[k]));
}
}
}
}
ll ans = 1e18;
for (int i = x; i <= y; i ++)
ans = min(ans, *min_element(dp[n][i].begin(), dp[n][i].end()));
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
94804 KB |
Output is correct |
2 |
Correct |
37 ms |
94808 KB |
Output is correct |
3 |
Correct |
41 ms |
94788 KB |
Output is correct |
4 |
Correct |
42 ms |
94792 KB |
Output is correct |
5 |
Correct |
40 ms |
94804 KB |
Output is correct |
6 |
Correct |
39 ms |
95068 KB |
Output is correct |
7 |
Correct |
41 ms |
95824 KB |
Output is correct |
8 |
Correct |
46 ms |
103812 KB |
Output is correct |
9 |
Correct |
47 ms |
103812 KB |
Output is correct |
10 |
Correct |
45 ms |
103816 KB |
Output is correct |
11 |
Correct |
46 ms |
103812 KB |
Output is correct |
12 |
Correct |
48 ms |
103816 KB |
Output is correct |
13 |
Correct |
49 ms |
103824 KB |
Output is correct |
14 |
Correct |
41 ms |
94800 KB |
Output is correct |
15 |
Correct |
52 ms |
94800 KB |
Output is correct |
16 |
Correct |
46 ms |
94804 KB |
Output is correct |
17 |
Correct |
40 ms |
94804 KB |
Output is correct |
18 |
Correct |
42 ms |
94804 KB |
Output is correct |
19 |
Correct |
41 ms |
95056 KB |
Output is correct |
20 |
Correct |
56 ms |
95824 KB |
Output is correct |
21 |
Correct |
57 ms |
103804 KB |
Output is correct |
22 |
Correct |
50 ms |
103824 KB |
Output is correct |
23 |
Correct |
48 ms |
103812 KB |
Output is correct |
24 |
Correct |
56 ms |
103940 KB |
Output is correct |
25 |
Correct |
48 ms |
103812 KB |
Output is correct |
26 |
Correct |
49 ms |
103816 KB |
Output is correct |
27 |
Correct |
41 ms |
94800 KB |
Output is correct |
28 |
Incorrect |
42 ms |
94800 KB |
Output isn't correct |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
94804 KB |
Output is correct |
2 |
Correct |
46 ms |
94800 KB |
Output is correct |
3 |
Correct |
43 ms |
94576 KB |
Output is correct |
4 |
Correct |
42 ms |
94808 KB |
Output is correct |
5 |
Correct |
43 ms |
94812 KB |
Output is correct |
6 |
Correct |
43 ms |
95060 KB |
Output is correct |
7 |
Correct |
42 ms |
95828 KB |
Output is correct |
8 |
Correct |
54 ms |
103812 KB |
Output is correct |
9 |
Correct |
50 ms |
103896 KB |
Output is correct |
10 |
Correct |
50 ms |
103824 KB |
Output is correct |
11 |
Correct |
49 ms |
103816 KB |
Output is correct |
12 |
Correct |
48 ms |
103808 KB |
Output is correct |
13 |
Correct |
49 ms |
103812 KB |
Output is correct |
14 |
Correct |
43 ms |
94804 KB |
Output is correct |
15 |
Correct |
42 ms |
94808 KB |
Output is correct |
16 |
Correct |
42 ms |
94800 KB |
Output is correct |
17 |
Correct |
43 ms |
94800 KB |
Output is correct |
18 |
Correct |
41 ms |
94808 KB |
Output is correct |
19 |
Correct |
44 ms |
95100 KB |
Output is correct |
20 |
Correct |
44 ms |
95828 KB |
Output is correct |
21 |
Correct |
50 ms |
103812 KB |
Output is correct |
22 |
Correct |
51 ms |
103816 KB |
Output is correct |
23 |
Correct |
47 ms |
103816 KB |
Output is correct |
24 |
Correct |
45 ms |
103812 KB |
Output is correct |
25 |
Correct |
49 ms |
103816 KB |
Output is correct |
26 |
Correct |
49 ms |
103816 KB |
Output is correct |
27 |
Correct |
55 ms |
112960 KB |
Output is correct |
28 |
Runtime error |
145 ms |
262144 KB |
Execution killed with signal 9 |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
94812 KB |
Output is correct |
2 |
Correct |
42 ms |
94808 KB |
Output is correct |
3 |
Correct |
42 ms |
94800 KB |
Output is correct |
4 |
Correct |
42 ms |
94804 KB |
Output is correct |
5 |
Correct |
42 ms |
94808 KB |
Output is correct |
6 |
Correct |
41 ms |
95056 KB |
Output is correct |
7 |
Correct |
43 ms |
95828 KB |
Output is correct |
8 |
Correct |
49 ms |
103816 KB |
Output is correct |
9 |
Correct |
48 ms |
103856 KB |
Output is correct |
10 |
Correct |
49 ms |
103812 KB |
Output is correct |
11 |
Correct |
48 ms |
103816 KB |
Output is correct |
12 |
Correct |
47 ms |
103960 KB |
Output is correct |
13 |
Correct |
48 ms |
103816 KB |
Output is correct |
14 |
Correct |
62 ms |
113216 KB |
Output is correct |
15 |
Runtime error |
147 ms |
262144 KB |
Execution killed with signal 9 |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
94584 KB |
Output is correct |
2 |
Correct |
46 ms |
94804 KB |
Output is correct |
3 |
Correct |
52 ms |
94800 KB |
Output is correct |
4 |
Correct |
42 ms |
94800 KB |
Output is correct |
5 |
Correct |
42 ms |
94800 KB |
Output is correct |
6 |
Correct |
41 ms |
95060 KB |
Output is correct |
7 |
Correct |
43 ms |
95828 KB |
Output is correct |
8 |
Correct |
48 ms |
103812 KB |
Output is correct |
9 |
Correct |
48 ms |
103816 KB |
Output is correct |
10 |
Correct |
50 ms |
103948 KB |
Output is correct |
11 |
Correct |
55 ms |
103852 KB |
Output is correct |
12 |
Correct |
50 ms |
103844 KB |
Output is correct |
13 |
Correct |
49 ms |
104008 KB |
Output is correct |
14 |
Correct |
43 ms |
94720 KB |
Output is correct |
15 |
Correct |
43 ms |
94800 KB |
Output is correct |
16 |
Correct |
42 ms |
94804 KB |
Output is correct |
17 |
Correct |
41 ms |
94800 KB |
Output is correct |
18 |
Correct |
42 ms |
94652 KB |
Output is correct |
19 |
Correct |
42 ms |
94976 KB |
Output is correct |
20 |
Correct |
47 ms |
95824 KB |
Output is correct |
21 |
Correct |
52 ms |
103964 KB |
Output is correct |
22 |
Correct |
48 ms |
103816 KB |
Output is correct |
23 |
Correct |
50 ms |
103964 KB |
Output is correct |
24 |
Correct |
49 ms |
103812 KB |
Output is correct |
25 |
Correct |
49 ms |
103816 KB |
Output is correct |
26 |
Correct |
49 ms |
103844 KB |
Output is correct |
27 |
Correct |
41 ms |
94800 KB |
Output is correct |
28 |
Incorrect |
43 ms |
94812 KB |
Output isn't correct |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
94804 KB |
Output is correct |
2 |
Correct |
50 ms |
94804 KB |
Output is correct |
3 |
Correct |
39 ms |
94812 KB |
Output is correct |
4 |
Correct |
41 ms |
94752 KB |
Output is correct |
5 |
Correct |
41 ms |
94800 KB |
Output is correct |
6 |
Correct |
42 ms |
95056 KB |
Output is correct |
7 |
Correct |
41 ms |
96092 KB |
Output is correct |
8 |
Correct |
46 ms |
103940 KB |
Output is correct |
9 |
Correct |
48 ms |
103824 KB |
Output is correct |
10 |
Correct |
52 ms |
103956 KB |
Output is correct |
11 |
Correct |
51 ms |
103816 KB |
Output is correct |
12 |
Correct |
48 ms |
103824 KB |
Output is correct |
13 |
Correct |
49 ms |
103840 KB |
Output is correct |
14 |
Correct |
40 ms |
94708 KB |
Output is correct |
15 |
Incorrect |
42 ms |
94804 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |