#include <bits/stdc++.h>
#define int long long
#define iris 998244353
using namespace std;
int arr[2010],n,a,b;
int cal(int ouo)
{
int i,res,cnt,sum;
res=cnt=sum=0;
for(i=0;i<n;i++)
{
sum+=arr[i];
if((ouo>>i)&1)
{
res|=sum;
sum=0;
cnt++;
}
}
if(cnt<a || cnt>b)
{
res=1e18;
}
return res;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int i,ans=1e18;
cin>>n>>a>>b;
for(i=0;i<n;i++)
{
cin>>arr[i];
}
for(i=(1<<(n-1));i<(1<<n);i++)
{
ans=min(ans, cal(i));
}
cout<<ans<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
9 ms |
384 KB |
Output is correct |
8 |
Correct |
40 ms |
384 KB |
Output is correct |
9 |
Correct |
40 ms |
384 KB |
Output is correct |
10 |
Correct |
40 ms |
384 KB |
Output is correct |
11 |
Correct |
40 ms |
384 KB |
Output is correct |
12 |
Correct |
40 ms |
384 KB |
Output is correct |
13 |
Correct |
44 ms |
504 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
6 ms |
384 KB |
Output is correct |
20 |
Correct |
9 ms |
384 KB |
Output is correct |
21 |
Correct |
41 ms |
384 KB |
Output is correct |
22 |
Correct |
40 ms |
384 KB |
Output is correct |
23 |
Correct |
42 ms |
512 KB |
Output is correct |
24 |
Correct |
40 ms |
384 KB |
Output is correct |
25 |
Correct |
40 ms |
384 KB |
Output is correct |
26 |
Correct |
40 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
288 KB |
Output is correct |
28 |
Correct |
5 ms |
384 KB |
Output is correct |
29 |
Correct |
6 ms |
384 KB |
Output is correct |
30 |
Correct |
22 ms |
384 KB |
Output is correct |
31 |
Correct |
40 ms |
384 KB |
Output is correct |
32 |
Correct |
40 ms |
384 KB |
Output is correct |
33 |
Correct |
40 ms |
384 KB |
Output is correct |
34 |
Correct |
41 ms |
384 KB |
Output is correct |
35 |
Correct |
40 ms |
384 KB |
Output is correct |
36 |
Correct |
40 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
9 ms |
384 KB |
Output is correct |
8 |
Correct |
40 ms |
384 KB |
Output is correct |
9 |
Correct |
40 ms |
384 KB |
Output is correct |
10 |
Correct |
40 ms |
384 KB |
Output is correct |
11 |
Correct |
40 ms |
384 KB |
Output is correct |
12 |
Correct |
40 ms |
384 KB |
Output is correct |
13 |
Correct |
40 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
4 ms |
384 KB |
Output is correct |
18 |
Correct |
4 ms |
384 KB |
Output is correct |
19 |
Correct |
6 ms |
384 KB |
Output is correct |
20 |
Correct |
9 ms |
384 KB |
Output is correct |
21 |
Correct |
40 ms |
384 KB |
Output is correct |
22 |
Correct |
40 ms |
384 KB |
Output is correct |
23 |
Correct |
40 ms |
384 KB |
Output is correct |
24 |
Correct |
40 ms |
384 KB |
Output is correct |
25 |
Correct |
42 ms |
388 KB |
Output is correct |
26 |
Correct |
40 ms |
384 KB |
Output is correct |
27 |
Correct |
77 ms |
384 KB |
Output is correct |
28 |
Execution timed out |
1091 ms |
384 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
9 ms |
384 KB |
Output is correct |
8 |
Correct |
40 ms |
384 KB |
Output is correct |
9 |
Correct |
40 ms |
384 KB |
Output is correct |
10 |
Correct |
41 ms |
384 KB |
Output is correct |
11 |
Correct |
40 ms |
384 KB |
Output is correct |
12 |
Correct |
46 ms |
384 KB |
Output is correct |
13 |
Correct |
40 ms |
384 KB |
Output is correct |
14 |
Correct |
76 ms |
288 KB |
Output is correct |
15 |
Execution timed out |
1095 ms |
384 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
9 ms |
384 KB |
Output is correct |
8 |
Correct |
40 ms |
384 KB |
Output is correct |
9 |
Correct |
40 ms |
384 KB |
Output is correct |
10 |
Correct |
40 ms |
384 KB |
Output is correct |
11 |
Correct |
41 ms |
384 KB |
Output is correct |
12 |
Correct |
40 ms |
384 KB |
Output is correct |
13 |
Correct |
40 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
4 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
9 ms |
384 KB |
Output is correct |
21 |
Correct |
40 ms |
384 KB |
Output is correct |
22 |
Correct |
40 ms |
384 KB |
Output is correct |
23 |
Correct |
40 ms |
384 KB |
Output is correct |
24 |
Correct |
40 ms |
384 KB |
Output is correct |
25 |
Correct |
40 ms |
384 KB |
Output is correct |
26 |
Correct |
40 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
5 ms |
384 KB |
Output is correct |
29 |
Correct |
5 ms |
384 KB |
Output is correct |
30 |
Correct |
23 ms |
384 KB |
Output is correct |
31 |
Correct |
40 ms |
384 KB |
Output is correct |
32 |
Correct |
44 ms |
384 KB |
Output is correct |
33 |
Correct |
40 ms |
384 KB |
Output is correct |
34 |
Correct |
40 ms |
384 KB |
Output is correct |
35 |
Correct |
40 ms |
384 KB |
Output is correct |
36 |
Correct |
40 ms |
384 KB |
Output is correct |
37 |
Correct |
77 ms |
384 KB |
Output is correct |
38 |
Execution timed out |
1094 ms |
384 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
9 ms |
384 KB |
Output is correct |
8 |
Correct |
41 ms |
384 KB |
Output is correct |
9 |
Correct |
40 ms |
384 KB |
Output is correct |
10 |
Correct |
40 ms |
384 KB |
Output is correct |
11 |
Correct |
41 ms |
384 KB |
Output is correct |
12 |
Correct |
40 ms |
384 KB |
Output is correct |
13 |
Correct |
40 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
22 ms |
384 KB |
Output is correct |
18 |
Correct |
41 ms |
384 KB |
Output is correct |
19 |
Correct |
40 ms |
384 KB |
Output is correct |
20 |
Correct |
40 ms |
384 KB |
Output is correct |
21 |
Correct |
42 ms |
384 KB |
Output is correct |
22 |
Correct |
40 ms |
384 KB |
Output is correct |
23 |
Correct |
40 ms |
384 KB |
Output is correct |
24 |
Correct |
76 ms |
384 KB |
Output is correct |
25 |
Execution timed out |
1093 ms |
384 KB |
Time limit exceeded |
26 |
Halted |
0 ms |
0 KB |
- |