#include <bits/stdc++.h>
using namespace std;
const int N=2005;
long long arr[N];
long long mem1[N][N],sum[N];
long long mem2[N];
int n,a,b;
long long go(int ind,int gr)
{
if(ind>=n&&a<=gr&&gr<=b)
return 0;
if(ind>=n)
return (1LL<<60);
if(mem1[ind][gr]!=-1)
return mem1[ind][gr];
mem1[ind][gr]=(1LL<<60);
for(int i=ind;i<n;i++)
{
long long cur=go(i+1,gr+1);
if(cur==(1LL<<60)) continue;
mem1[ind][gr]=min(mem1[ind][gr],(sum[i]-(ind?sum[ind-1]:0))|cur);
}
return mem1[ind][gr];
}
int main()
{
cin >> n >> a >> b;
for(int i=0;i<n;i++)
cin >> arr[i];
/*if(n>100)
{
cout << "m3lsh" << endl;
}
else
{*/
memset(mem1,-1,sizeof mem1);
for(int i=0;i<n;i++)
sum[i]=arr[i]+(i?sum[i-1]:0);
cout << go(0,0) << endl;
//}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
31864 KB |
Output is correct |
2 |
Correct |
28 ms |
31864 KB |
Output is correct |
3 |
Correct |
28 ms |
31864 KB |
Output is correct |
4 |
Correct |
28 ms |
31864 KB |
Output is correct |
5 |
Correct |
28 ms |
31864 KB |
Output is correct |
6 |
Correct |
28 ms |
31736 KB |
Output is correct |
7 |
Correct |
28 ms |
31740 KB |
Output is correct |
8 |
Correct |
29 ms |
31864 KB |
Output is correct |
9 |
Correct |
28 ms |
31736 KB |
Output is correct |
10 |
Correct |
28 ms |
31864 KB |
Output is correct |
11 |
Correct |
28 ms |
31736 KB |
Output is correct |
12 |
Correct |
28 ms |
31864 KB |
Output is correct |
13 |
Correct |
28 ms |
31864 KB |
Output is correct |
14 |
Correct |
28 ms |
31736 KB |
Output is correct |
15 |
Correct |
28 ms |
31868 KB |
Output is correct |
16 |
Correct |
28 ms |
31868 KB |
Output is correct |
17 |
Correct |
28 ms |
31736 KB |
Output is correct |
18 |
Correct |
28 ms |
31864 KB |
Output is correct |
19 |
Correct |
28 ms |
31736 KB |
Output is correct |
20 |
Correct |
28 ms |
31864 KB |
Output is correct |
21 |
Incorrect |
28 ms |
31868 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
31736 KB |
Output is correct |
2 |
Correct |
27 ms |
31864 KB |
Output is correct |
3 |
Correct |
28 ms |
31736 KB |
Output is correct |
4 |
Correct |
28 ms |
31868 KB |
Output is correct |
5 |
Correct |
28 ms |
31736 KB |
Output is correct |
6 |
Correct |
28 ms |
31736 KB |
Output is correct |
7 |
Correct |
28 ms |
31864 KB |
Output is correct |
8 |
Correct |
28 ms |
31736 KB |
Output is correct |
9 |
Correct |
28 ms |
31864 KB |
Output is correct |
10 |
Correct |
28 ms |
31736 KB |
Output is correct |
11 |
Correct |
28 ms |
31736 KB |
Output is correct |
12 |
Correct |
28 ms |
31868 KB |
Output is correct |
13 |
Correct |
28 ms |
31864 KB |
Output is correct |
14 |
Correct |
28 ms |
31864 KB |
Output is correct |
15 |
Correct |
28 ms |
31864 KB |
Output is correct |
16 |
Correct |
28 ms |
31864 KB |
Output is correct |
17 |
Correct |
28 ms |
31864 KB |
Output is correct |
18 |
Correct |
27 ms |
31864 KB |
Output is correct |
19 |
Correct |
28 ms |
31864 KB |
Output is correct |
20 |
Correct |
28 ms |
31736 KB |
Output is correct |
21 |
Incorrect |
28 ms |
31864 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
31864 KB |
Output is correct |
2 |
Correct |
28 ms |
31864 KB |
Output is correct |
3 |
Correct |
28 ms |
31812 KB |
Output is correct |
4 |
Correct |
28 ms |
31864 KB |
Output is correct |
5 |
Correct |
28 ms |
31736 KB |
Output is correct |
6 |
Correct |
34 ms |
31864 KB |
Output is correct |
7 |
Correct |
29 ms |
31864 KB |
Output is correct |
8 |
Correct |
28 ms |
31864 KB |
Output is correct |
9 |
Correct |
28 ms |
31736 KB |
Output is correct |
10 |
Correct |
28 ms |
31836 KB |
Output is correct |
11 |
Correct |
28 ms |
31864 KB |
Output is correct |
12 |
Correct |
28 ms |
31864 KB |
Output is correct |
13 |
Correct |
28 ms |
31736 KB |
Output is correct |
14 |
Correct |
28 ms |
31736 KB |
Output is correct |
15 |
Correct |
28 ms |
31796 KB |
Output is correct |
16 |
Correct |
28 ms |
31736 KB |
Output is correct |
17 |
Correct |
28 ms |
31864 KB |
Output is correct |
18 |
Correct |
28 ms |
31736 KB |
Output is correct |
19 |
Correct |
28 ms |
31864 KB |
Output is correct |
20 |
Correct |
28 ms |
31864 KB |
Output is correct |
21 |
Correct |
28 ms |
31992 KB |
Output is correct |
22 |
Correct |
28 ms |
31736 KB |
Output is correct |
23 |
Correct |
28 ms |
31736 KB |
Output is correct |
24 |
Correct |
28 ms |
31848 KB |
Output is correct |
25 |
Correct |
28 ms |
31864 KB |
Output is correct |
26 |
Correct |
28 ms |
31824 KB |
Output is correct |
27 |
Correct |
29 ms |
31864 KB |
Output is correct |
28 |
Correct |
29 ms |
31864 KB |
Output is correct |
29 |
Correct |
30 ms |
31864 KB |
Output is correct |
30 |
Correct |
29 ms |
31736 KB |
Output is correct |
31 |
Correct |
29 ms |
31864 KB |
Output is correct |
32 |
Correct |
29 ms |
31868 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
31736 KB |
Output is correct |
2 |
Correct |
28 ms |
31736 KB |
Output is correct |
3 |
Correct |
28 ms |
31864 KB |
Output is correct |
4 |
Correct |
28 ms |
31764 KB |
Output is correct |
5 |
Correct |
28 ms |
31736 KB |
Output is correct |
6 |
Correct |
28 ms |
31736 KB |
Output is correct |
7 |
Correct |
28 ms |
31836 KB |
Output is correct |
8 |
Correct |
28 ms |
31864 KB |
Output is correct |
9 |
Correct |
28 ms |
31864 KB |
Output is correct |
10 |
Correct |
28 ms |
31736 KB |
Output is correct |
11 |
Correct |
28 ms |
31864 KB |
Output is correct |
12 |
Correct |
28 ms |
31864 KB |
Output is correct |
13 |
Correct |
28 ms |
31736 KB |
Output is correct |
14 |
Correct |
28 ms |
31864 KB |
Output is correct |
15 |
Correct |
28 ms |
31864 KB |
Output is correct |
16 |
Correct |
28 ms |
31812 KB |
Output is correct |
17 |
Correct |
28 ms |
31864 KB |
Output is correct |
18 |
Correct |
28 ms |
31864 KB |
Output is correct |
19 |
Correct |
29 ms |
31864 KB |
Output is correct |
20 |
Correct |
28 ms |
31864 KB |
Output is correct |
21 |
Incorrect |
28 ms |
31736 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
31864 KB |
Output is correct |
2 |
Correct |
29 ms |
31864 KB |
Output is correct |
3 |
Correct |
29 ms |
31864 KB |
Output is correct |
4 |
Correct |
29 ms |
31864 KB |
Output is correct |
5 |
Correct |
28 ms |
31736 KB |
Output is correct |
6 |
Correct |
28 ms |
31736 KB |
Output is correct |
7 |
Correct |
30 ms |
31864 KB |
Output is correct |
8 |
Correct |
28 ms |
31864 KB |
Output is correct |
9 |
Correct |
28 ms |
31864 KB |
Output is correct |
10 |
Correct |
28 ms |
31836 KB |
Output is correct |
11 |
Correct |
28 ms |
31864 KB |
Output is correct |
12 |
Correct |
29 ms |
31864 KB |
Output is correct |
13 |
Correct |
28 ms |
31864 KB |
Output is correct |
14 |
Correct |
28 ms |
31864 KB |
Output is correct |
15 |
Correct |
34 ms |
31940 KB |
Output is correct |
16 |
Correct |
28 ms |
31736 KB |
Output is correct |
17 |
Correct |
28 ms |
31864 KB |
Output is correct |
18 |
Incorrect |
28 ms |
31864 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |