#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,k,x,y,z;
ll mn[2005];
ll a,b,ar[2005];
void exhaust(ll id, ll ttl, ll sum, ll cut) {
if (id > n) {
mn[cut] = min(mn[cut],ttl | sum);
return;
}
exhaust(id+1,ttl,sum+ar[id],cut);
if (id != 1) exhaust(id+1,ttl | sum,ar[id],cut+1);
}
signed main() {
cin >> n >> a >> b;
for (int i = 1; i <= n; i++) mn[i] = LLONG_MAX;
for (int i = 1; i <= n; i++) cin >> ar[i];
exhaust(1,0,0,1);
ll ans = LLONG_MAX;
for (int i = a; i <= b; i++) ans = min(ans,mn[i]);
cout << ans << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
3 ms |
212 KB |
Output is correct |
9 |
Correct |
4 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
304 KB |
Output is correct |
11 |
Correct |
3 ms |
212 KB |
Output is correct |
12 |
Correct |
3 ms |
212 KB |
Output is correct |
13 |
Correct |
4 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
4 ms |
212 KB |
Output is correct |
22 |
Correct |
4 ms |
212 KB |
Output is correct |
23 |
Correct |
3 ms |
212 KB |
Output is correct |
24 |
Correct |
4 ms |
212 KB |
Output is correct |
25 |
Correct |
3 ms |
212 KB |
Output is correct |
26 |
Correct |
5 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
300 KB |
Output is correct |
29 |
Correct |
1 ms |
304 KB |
Output is correct |
30 |
Correct |
2 ms |
212 KB |
Output is correct |
31 |
Correct |
4 ms |
340 KB |
Output is correct |
32 |
Correct |
3 ms |
212 KB |
Output is correct |
33 |
Correct |
3 ms |
212 KB |
Output is correct |
34 |
Correct |
4 ms |
212 KB |
Output is correct |
35 |
Correct |
5 ms |
256 KB |
Output is correct |
36 |
Correct |
4 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
3 ms |
340 KB |
Output is correct |
9 |
Correct |
3 ms |
300 KB |
Output is correct |
10 |
Correct |
3 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
212 KB |
Output is correct |
12 |
Correct |
3 ms |
212 KB |
Output is correct |
13 |
Correct |
4 ms |
304 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
212 KB |
Output is correct |
21 |
Correct |
3 ms |
212 KB |
Output is correct |
22 |
Correct |
3 ms |
212 KB |
Output is correct |
23 |
Correct |
5 ms |
212 KB |
Output is correct |
24 |
Correct |
4 ms |
212 KB |
Output is correct |
25 |
Correct |
4 ms |
212 KB |
Output is correct |
26 |
Correct |
3 ms |
212 KB |
Output is correct |
27 |
Correct |
6 ms |
212 KB |
Output is correct |
28 |
Correct |
86 ms |
288 KB |
Output is correct |
29 |
Execution timed out |
1094 ms |
212 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
3 ms |
212 KB |
Output is correct |
9 |
Correct |
3 ms |
212 KB |
Output is correct |
10 |
Correct |
3 ms |
212 KB |
Output is correct |
11 |
Correct |
4 ms |
212 KB |
Output is correct |
12 |
Correct |
5 ms |
212 KB |
Output is correct |
13 |
Correct |
3 ms |
308 KB |
Output is correct |
14 |
Correct |
7 ms |
212 KB |
Output is correct |
15 |
Correct |
102 ms |
280 KB |
Output is correct |
16 |
Execution timed out |
1090 ms |
212 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
3 ms |
212 KB |
Output is correct |
9 |
Correct |
5 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
212 KB |
Output is correct |
12 |
Correct |
4 ms |
212 KB |
Output is correct |
13 |
Correct |
4 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
3 ms |
212 KB |
Output is correct |
22 |
Correct |
4 ms |
304 KB |
Output is correct |
23 |
Correct |
4 ms |
212 KB |
Output is correct |
24 |
Correct |
5 ms |
212 KB |
Output is correct |
25 |
Correct |
4 ms |
212 KB |
Output is correct |
26 |
Correct |
4 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
2 ms |
212 KB |
Output is correct |
31 |
Correct |
3 ms |
212 KB |
Output is correct |
32 |
Correct |
3 ms |
212 KB |
Output is correct |
33 |
Correct |
3 ms |
212 KB |
Output is correct |
34 |
Correct |
4 ms |
212 KB |
Output is correct |
35 |
Correct |
3 ms |
212 KB |
Output is correct |
36 |
Correct |
3 ms |
212 KB |
Output is correct |
37 |
Correct |
7 ms |
212 KB |
Output is correct |
38 |
Correct |
83 ms |
340 KB |
Output is correct |
39 |
Execution timed out |
1075 ms |
212 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
3 ms |
300 KB |
Output is correct |
9 |
Correct |
3 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
212 KB |
Output is correct |
11 |
Correct |
4 ms |
212 KB |
Output is correct |
12 |
Correct |
5 ms |
300 KB |
Output is correct |
13 |
Correct |
4 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
2 ms |
212 KB |
Output is correct |
18 |
Correct |
4 ms |
212 KB |
Output is correct |
19 |
Correct |
3 ms |
308 KB |
Output is correct |
20 |
Correct |
3 ms |
212 KB |
Output is correct |
21 |
Correct |
4 ms |
300 KB |
Output is correct |
22 |
Correct |
4 ms |
212 KB |
Output is correct |
23 |
Correct |
4 ms |
212 KB |
Output is correct |
24 |
Correct |
8 ms |
304 KB |
Output is correct |
25 |
Correct |
99 ms |
300 KB |
Output is correct |
26 |
Execution timed out |
1067 ms |
212 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |