#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl "\n"
llo n,a,b;
llo mi=10000000000000;
llo it[101];
void brute(llo ind,llo tot,llo orr,llo lev){
if(ind==n){
if(tot){
orr=orr|tot;
lev+=1;
}
if(lev>=a and lev<=b){
mi=min(mi,orr);
}
}
else{
brute(ind+1,0,orr|(tot+it[ind]),lev+1);
brute(ind+1,tot+it[ind],orr,lev);
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>a>>b;
for(llo i=0;i<n;i++){
cin>>it[i];
}
brute(0,0,0,0);
cout<<mi<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
376 KB |
Output is correct |
8 |
Correct |
12 ms |
376 KB |
Output is correct |
9 |
Correct |
12 ms |
376 KB |
Output is correct |
10 |
Correct |
12 ms |
380 KB |
Output is correct |
11 |
Correct |
12 ms |
380 KB |
Output is correct |
12 |
Correct |
13 ms |
376 KB |
Output is correct |
13 |
Correct |
12 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
18 |
Correct |
5 ms |
376 KB |
Output is correct |
19 |
Correct |
5 ms |
376 KB |
Output is correct |
20 |
Correct |
5 ms |
256 KB |
Output is correct |
21 |
Correct |
12 ms |
376 KB |
Output is correct |
22 |
Correct |
12 ms |
376 KB |
Output is correct |
23 |
Correct |
12 ms |
376 KB |
Output is correct |
24 |
Correct |
12 ms |
376 KB |
Output is correct |
25 |
Correct |
12 ms |
376 KB |
Output is correct |
26 |
Correct |
12 ms |
376 KB |
Output is correct |
27 |
Correct |
5 ms |
376 KB |
Output is correct |
28 |
Correct |
5 ms |
376 KB |
Output is correct |
29 |
Correct |
6 ms |
376 KB |
Output is correct |
30 |
Correct |
8 ms |
376 KB |
Output is correct |
31 |
Correct |
12 ms |
376 KB |
Output is correct |
32 |
Correct |
12 ms |
376 KB |
Output is correct |
33 |
Correct |
12 ms |
376 KB |
Output is correct |
34 |
Correct |
11 ms |
376 KB |
Output is correct |
35 |
Correct |
12 ms |
376 KB |
Output is correct |
36 |
Correct |
12 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
12 ms |
376 KB |
Output is correct |
9 |
Correct |
12 ms |
380 KB |
Output is correct |
10 |
Correct |
11 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
376 KB |
Output is correct |
12 |
Correct |
13 ms |
372 KB |
Output is correct |
13 |
Correct |
12 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
18 |
Correct |
6 ms |
376 KB |
Output is correct |
19 |
Correct |
5 ms |
376 KB |
Output is correct |
20 |
Correct |
5 ms |
380 KB |
Output is correct |
21 |
Correct |
13 ms |
376 KB |
Output is correct |
22 |
Correct |
12 ms |
376 KB |
Output is correct |
23 |
Correct |
12 ms |
376 KB |
Output is correct |
24 |
Correct |
12 ms |
376 KB |
Output is correct |
25 |
Correct |
11 ms |
376 KB |
Output is correct |
26 |
Correct |
12 ms |
376 KB |
Output is correct |
27 |
Correct |
18 ms |
376 KB |
Output is correct |
28 |
Correct |
227 ms |
376 KB |
Output is correct |
29 |
Execution timed out |
1092 ms |
256 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
376 KB |
Output is correct |
8 |
Correct |
12 ms |
376 KB |
Output is correct |
9 |
Correct |
12 ms |
376 KB |
Output is correct |
10 |
Correct |
12 ms |
376 KB |
Output is correct |
11 |
Correct |
13 ms |
376 KB |
Output is correct |
12 |
Correct |
12 ms |
376 KB |
Output is correct |
13 |
Correct |
12 ms |
256 KB |
Output is correct |
14 |
Correct |
19 ms |
376 KB |
Output is correct |
15 |
Correct |
225 ms |
376 KB |
Output is correct |
16 |
Execution timed out |
1081 ms |
376 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
352 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
12 ms |
376 KB |
Output is correct |
9 |
Correct |
12 ms |
376 KB |
Output is correct |
10 |
Correct |
12 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
372 KB |
Output is correct |
12 |
Correct |
12 ms |
376 KB |
Output is correct |
13 |
Correct |
13 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
18 |
Correct |
5 ms |
376 KB |
Output is correct |
19 |
Correct |
5 ms |
376 KB |
Output is correct |
20 |
Correct |
5 ms |
376 KB |
Output is correct |
21 |
Correct |
11 ms |
376 KB |
Output is correct |
22 |
Correct |
11 ms |
376 KB |
Output is correct |
23 |
Correct |
11 ms |
376 KB |
Output is correct |
24 |
Correct |
11 ms |
376 KB |
Output is correct |
25 |
Correct |
12 ms |
376 KB |
Output is correct |
26 |
Correct |
12 ms |
376 KB |
Output is correct |
27 |
Correct |
5 ms |
376 KB |
Output is correct |
28 |
Correct |
5 ms |
376 KB |
Output is correct |
29 |
Correct |
5 ms |
376 KB |
Output is correct |
30 |
Correct |
8 ms |
376 KB |
Output is correct |
31 |
Correct |
12 ms |
376 KB |
Output is correct |
32 |
Correct |
12 ms |
376 KB |
Output is correct |
33 |
Correct |
12 ms |
376 KB |
Output is correct |
34 |
Correct |
13 ms |
504 KB |
Output is correct |
35 |
Correct |
12 ms |
376 KB |
Output is correct |
36 |
Correct |
12 ms |
376 KB |
Output is correct |
37 |
Correct |
18 ms |
376 KB |
Output is correct |
38 |
Correct |
226 ms |
504 KB |
Output is correct |
39 |
Execution timed out |
1089 ms |
376 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
12 ms |
376 KB |
Output is correct |
9 |
Correct |
12 ms |
376 KB |
Output is correct |
10 |
Correct |
13 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
376 KB |
Output is correct |
12 |
Correct |
12 ms |
376 KB |
Output is correct |
13 |
Correct |
12 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
8 ms |
376 KB |
Output is correct |
18 |
Correct |
12 ms |
380 KB |
Output is correct |
19 |
Correct |
12 ms |
376 KB |
Output is correct |
20 |
Correct |
13 ms |
376 KB |
Output is correct |
21 |
Correct |
12 ms |
376 KB |
Output is correct |
22 |
Correct |
13 ms |
376 KB |
Output is correct |
23 |
Correct |
11 ms |
376 KB |
Output is correct |
24 |
Correct |
21 ms |
376 KB |
Output is correct |
25 |
Correct |
225 ms |
376 KB |
Output is correct |
26 |
Execution timed out |
1091 ms |
376 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |