#include <bits/stdc++.h>
#define st first
#define nd second
using namespace std;
const long long INF = 1e9;
const int MOD = 1e9+7;
const int MAXN = 30000;
int n, l, r;
int v[100];
int func(int f, int k, int cnt, int sum, int orr) {
int ans = INF;
if(k > r) return INF;
if(f == n+1) {
if(k < l || k > r) return INF;
//cout << f << " " << k << " " << (orr|sum) << endl;
return orr|sum;
}
ans = func(f+1,k,cnt+1,sum+v[f],orr);
if(cnt != 0)
ans = min(ans,func(f+1,k+1,1,v[f],sum|orr));
return ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> l >> r;
for(int i = 1; i <= n; i++)
cin >> v[i];
cout << func(1,1,0,0,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
424 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
556 KB |
Output is correct |
6 |
Correct |
2 ms |
632 KB |
Output is correct |
7 |
Correct |
2 ms |
636 KB |
Output is correct |
8 |
Correct |
2 ms |
640 KB |
Output is correct |
9 |
Correct |
2 ms |
644 KB |
Output is correct |
10 |
Correct |
2 ms |
648 KB |
Output is correct |
11 |
Correct |
2 ms |
780 KB |
Output is correct |
12 |
Correct |
2 ms |
780 KB |
Output is correct |
13 |
Correct |
7 ms |
780 KB |
Output is correct |
14 |
Correct |
1 ms |
780 KB |
Output is correct |
15 |
Correct |
2 ms |
780 KB |
Output is correct |
16 |
Correct |
1 ms |
780 KB |
Output is correct |
17 |
Correct |
1 ms |
780 KB |
Output is correct |
18 |
Correct |
1 ms |
780 KB |
Output is correct |
19 |
Correct |
2 ms |
780 KB |
Output is correct |
20 |
Correct |
1 ms |
780 KB |
Output is correct |
21 |
Correct |
2 ms |
780 KB |
Output is correct |
22 |
Correct |
2 ms |
780 KB |
Output is correct |
23 |
Correct |
2 ms |
780 KB |
Output is correct |
24 |
Correct |
1 ms |
780 KB |
Output is correct |
25 |
Correct |
2 ms |
780 KB |
Output is correct |
26 |
Correct |
7 ms |
780 KB |
Output is correct |
27 |
Incorrect |
2 ms |
780 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
780 KB |
Output is correct |
2 |
Correct |
2 ms |
780 KB |
Output is correct |
3 |
Correct |
2 ms |
848 KB |
Output is correct |
4 |
Correct |
2 ms |
848 KB |
Output is correct |
5 |
Correct |
2 ms |
848 KB |
Output is correct |
6 |
Correct |
2 ms |
848 KB |
Output is correct |
7 |
Correct |
2 ms |
848 KB |
Output is correct |
8 |
Correct |
2 ms |
848 KB |
Output is correct |
9 |
Correct |
2 ms |
848 KB |
Output is correct |
10 |
Correct |
2 ms |
848 KB |
Output is correct |
11 |
Correct |
2 ms |
868 KB |
Output is correct |
12 |
Correct |
2 ms |
868 KB |
Output is correct |
13 |
Correct |
6 ms |
868 KB |
Output is correct |
14 |
Correct |
2 ms |
868 KB |
Output is correct |
15 |
Correct |
1 ms |
868 KB |
Output is correct |
16 |
Correct |
1 ms |
868 KB |
Output is correct |
17 |
Correct |
2 ms |
868 KB |
Output is correct |
18 |
Correct |
2 ms |
868 KB |
Output is correct |
19 |
Correct |
2 ms |
868 KB |
Output is correct |
20 |
Correct |
2 ms |
868 KB |
Output is correct |
21 |
Correct |
2 ms |
868 KB |
Output is correct |
22 |
Correct |
3 ms |
868 KB |
Output is correct |
23 |
Correct |
2 ms |
868 KB |
Output is correct |
24 |
Correct |
1 ms |
868 KB |
Output is correct |
25 |
Correct |
2 ms |
868 KB |
Output is correct |
26 |
Correct |
6 ms |
868 KB |
Output is correct |
27 |
Correct |
12 ms |
868 KB |
Output is correct |
28 |
Correct |
42 ms |
868 KB |
Output is correct |
29 |
Correct |
6 ms |
868 KB |
Output is correct |
30 |
Execution timed out |
1079 ms |
868 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
868 KB |
Output is correct |
2 |
Correct |
1 ms |
868 KB |
Output is correct |
3 |
Correct |
1 ms |
868 KB |
Output is correct |
4 |
Correct |
1 ms |
868 KB |
Output is correct |
5 |
Correct |
1 ms |
868 KB |
Output is correct |
6 |
Correct |
2 ms |
868 KB |
Output is correct |
7 |
Correct |
2 ms |
868 KB |
Output is correct |
8 |
Correct |
2 ms |
868 KB |
Output is correct |
9 |
Correct |
2 ms |
868 KB |
Output is correct |
10 |
Correct |
2 ms |
868 KB |
Output is correct |
11 |
Correct |
1 ms |
868 KB |
Output is correct |
12 |
Correct |
2 ms |
868 KB |
Output is correct |
13 |
Correct |
6 ms |
872 KB |
Output is correct |
14 |
Correct |
12 ms |
876 KB |
Output is correct |
15 |
Correct |
40 ms |
880 KB |
Output is correct |
16 |
Correct |
7 ms |
888 KB |
Output is correct |
17 |
Execution timed out |
1066 ms |
1012 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1012 KB |
Output is correct |
2 |
Correct |
2 ms |
1012 KB |
Output is correct |
3 |
Correct |
2 ms |
1012 KB |
Output is correct |
4 |
Correct |
2 ms |
1012 KB |
Output is correct |
5 |
Correct |
2 ms |
1012 KB |
Output is correct |
6 |
Correct |
6 ms |
1012 KB |
Output is correct |
7 |
Correct |
2 ms |
1012 KB |
Output is correct |
8 |
Correct |
2 ms |
1012 KB |
Output is correct |
9 |
Correct |
2 ms |
1012 KB |
Output is correct |
10 |
Correct |
1 ms |
1012 KB |
Output is correct |
11 |
Correct |
2 ms |
1012 KB |
Output is correct |
12 |
Correct |
1 ms |
1012 KB |
Output is correct |
13 |
Correct |
11 ms |
1012 KB |
Output is correct |
14 |
Correct |
2 ms |
1012 KB |
Output is correct |
15 |
Correct |
2 ms |
1012 KB |
Output is correct |
16 |
Correct |
1 ms |
1012 KB |
Output is correct |
17 |
Correct |
2 ms |
1012 KB |
Output is correct |
18 |
Correct |
1 ms |
1012 KB |
Output is correct |
19 |
Correct |
2 ms |
1012 KB |
Output is correct |
20 |
Correct |
2 ms |
1012 KB |
Output is correct |
21 |
Correct |
2 ms |
1012 KB |
Output is correct |
22 |
Correct |
3 ms |
1012 KB |
Output is correct |
23 |
Correct |
3 ms |
1012 KB |
Output is correct |
24 |
Correct |
1 ms |
1012 KB |
Output is correct |
25 |
Correct |
3 ms |
1012 KB |
Output is correct |
26 |
Correct |
7 ms |
1012 KB |
Output is correct |
27 |
Incorrect |
1 ms |
1012 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1012 KB |
Output is correct |
2 |
Correct |
2 ms |
1012 KB |
Output is correct |
3 |
Correct |
2 ms |
1012 KB |
Output is correct |
4 |
Correct |
2 ms |
1012 KB |
Output is correct |
5 |
Correct |
2 ms |
1012 KB |
Output is correct |
6 |
Correct |
2 ms |
1012 KB |
Output is correct |
7 |
Correct |
2 ms |
1012 KB |
Output is correct |
8 |
Correct |
2 ms |
1132 KB |
Output is correct |
9 |
Correct |
2 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
1132 KB |
Output is correct |
11 |
Correct |
2 ms |
1132 KB |
Output is correct |
12 |
Correct |
1 ms |
1132 KB |
Output is correct |
13 |
Correct |
6 ms |
1132 KB |
Output is correct |
14 |
Incorrect |
1 ms |
1132 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |