#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a,b,mn=1000000000000000009ll;
ll arr[50];
void bt(ll id,ll sum,ll curr,ll flag,bool flag2){
if(id == n){
if(flag < a || flag > b || !flag2) return;
mn = min(mn,curr); return;
}
sum += arr[id];
bt(id+1,sum,curr,flag,0);
curr |= sum;
bt(id+1,0,curr,flag+1,1);
}
int main(){
cin>>n>>a>>b;
for(int i=0;i<n;i++) cin>>arr[i];
bt(0,0,0,0,0);
cout<<mn<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
8 ms |
384 KB |
Output is correct |
9 |
Correct |
8 ms |
384 KB |
Output is correct |
10 |
Correct |
11 ms |
384 KB |
Output is correct |
11 |
Correct |
8 ms |
384 KB |
Output is correct |
12 |
Correct |
8 ms |
384 KB |
Output is correct |
13 |
Correct |
9 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
19 |
Correct |
3 ms |
384 KB |
Output is correct |
20 |
Correct |
2 ms |
384 KB |
Output is correct |
21 |
Correct |
6 ms |
256 KB |
Output is correct |
22 |
Correct |
8 ms |
384 KB |
Output is correct |
23 |
Correct |
10 ms |
384 KB |
Output is correct |
24 |
Correct |
8 ms |
384 KB |
Output is correct |
25 |
Correct |
7 ms |
256 KB |
Output is correct |
26 |
Correct |
8 ms |
384 KB |
Output is correct |
27 |
Correct |
3 ms |
256 KB |
Output is correct |
28 |
Correct |
2 ms |
384 KB |
Output is correct |
29 |
Correct |
2 ms |
384 KB |
Output is correct |
30 |
Correct |
6 ms |
256 KB |
Output is correct |
31 |
Correct |
7 ms |
256 KB |
Output is correct |
32 |
Correct |
11 ms |
384 KB |
Output is correct |
33 |
Correct |
8 ms |
384 KB |
Output is correct |
34 |
Correct |
9 ms |
384 KB |
Output is correct |
35 |
Correct |
9 ms |
384 KB |
Output is correct |
36 |
Correct |
9 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
4 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
8 ms |
256 KB |
Output is correct |
9 |
Correct |
10 ms |
256 KB |
Output is correct |
10 |
Correct |
8 ms |
384 KB |
Output is correct |
11 |
Correct |
8 ms |
384 KB |
Output is correct |
12 |
Correct |
8 ms |
384 KB |
Output is correct |
13 |
Correct |
10 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
512 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
19 |
Correct |
3 ms |
384 KB |
Output is correct |
20 |
Correct |
3 ms |
256 KB |
Output is correct |
21 |
Correct |
11 ms |
384 KB |
Output is correct |
22 |
Correct |
10 ms |
256 KB |
Output is correct |
23 |
Correct |
10 ms |
256 KB |
Output is correct |
24 |
Correct |
8 ms |
384 KB |
Output is correct |
25 |
Correct |
10 ms |
256 KB |
Output is correct |
26 |
Correct |
9 ms |
384 KB |
Output is correct |
27 |
Correct |
21 ms |
384 KB |
Output is correct |
28 |
Correct |
201 ms |
384 KB |
Output is correct |
29 |
Execution timed out |
1087 ms |
384 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
8 ms |
256 KB |
Output is correct |
9 |
Correct |
8 ms |
384 KB |
Output is correct |
10 |
Correct |
7 ms |
256 KB |
Output is correct |
11 |
Correct |
7 ms |
384 KB |
Output is correct |
12 |
Correct |
8 ms |
428 KB |
Output is correct |
13 |
Correct |
9 ms |
384 KB |
Output is correct |
14 |
Correct |
17 ms |
256 KB |
Output is correct |
15 |
Correct |
213 ms |
256 KB |
Output is correct |
16 |
Execution timed out |
1071 ms |
256 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
428 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
9 ms |
384 KB |
Output is correct |
9 |
Correct |
11 ms |
256 KB |
Output is correct |
10 |
Correct |
8 ms |
384 KB |
Output is correct |
11 |
Correct |
8 ms |
384 KB |
Output is correct |
12 |
Correct |
9 ms |
384 KB |
Output is correct |
13 |
Correct |
7 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
19 |
Correct |
3 ms |
384 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
7 ms |
384 KB |
Output is correct |
22 |
Correct |
6 ms |
256 KB |
Output is correct |
23 |
Correct |
7 ms |
384 KB |
Output is correct |
24 |
Correct |
8 ms |
256 KB |
Output is correct |
25 |
Correct |
9 ms |
384 KB |
Output is correct |
26 |
Correct |
8 ms |
256 KB |
Output is correct |
27 |
Correct |
2 ms |
384 KB |
Output is correct |
28 |
Correct |
2 ms |
384 KB |
Output is correct |
29 |
Correct |
2 ms |
384 KB |
Output is correct |
30 |
Correct |
5 ms |
256 KB |
Output is correct |
31 |
Correct |
12 ms |
356 KB |
Output is correct |
32 |
Correct |
8 ms |
384 KB |
Output is correct |
33 |
Correct |
7 ms |
256 KB |
Output is correct |
34 |
Correct |
8 ms |
384 KB |
Output is correct |
35 |
Correct |
7 ms |
384 KB |
Output is correct |
36 |
Correct |
10 ms |
356 KB |
Output is correct |
37 |
Correct |
15 ms |
256 KB |
Output is correct |
38 |
Correct |
183 ms |
372 KB |
Output is correct |
39 |
Execution timed out |
1069 ms |
256 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
308 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
7 ms |
384 KB |
Output is correct |
9 |
Correct |
7 ms |
256 KB |
Output is correct |
10 |
Correct |
8 ms |
256 KB |
Output is correct |
11 |
Correct |
9 ms |
384 KB |
Output is correct |
12 |
Correct |
8 ms |
432 KB |
Output is correct |
13 |
Correct |
9 ms |
256 KB |
Output is correct |
14 |
Correct |
3 ms |
300 KB |
Output is correct |
15 |
Correct |
4 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
384 KB |
Output is correct |
18 |
Correct |
8 ms |
412 KB |
Output is correct |
19 |
Correct |
8 ms |
256 KB |
Output is correct |
20 |
Correct |
9 ms |
384 KB |
Output is correct |
21 |
Correct |
8 ms |
384 KB |
Output is correct |
22 |
Correct |
11 ms |
384 KB |
Output is correct |
23 |
Correct |
9 ms |
384 KB |
Output is correct |
24 |
Correct |
18 ms |
252 KB |
Output is correct |
25 |
Correct |
184 ms |
384 KB |
Output is correct |
26 |
Execution timed out |
1070 ms |
384 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |