#include <bits/stdc++.h>
#define int long long
#define iris 998244353
using namespace std;
set<int> dp[2010][2010];
int arr[2010];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,ans,i,j,k,a,b;
cin>>n>>a>>b;
for(i=1;i<=n;i++)
{
cin>>arr[i];
arr[i]+=arr[i-1];
}
dp[0][0].insert(0);
for(i=1;i<=b;i++)
{
for(j=1;j<=n;j++)
{
for(k=0;k<j;k++)
{
for(int ouo:dp[i-1][k])
{
dp[i][j].insert(ouo|(arr[j]-arr[k]));
}
}
}
}
ans=1e18;
for(i=a;i<=n;i++)
{
ans=min(ans, *dp[b][n].lower_bound(-1));
}
cout<<ans<<'\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
114 ms |
190244 KB |
Output is correct |
2 |
Correct |
116 ms |
190072 KB |
Output is correct |
3 |
Correct |
113 ms |
190052 KB |
Output is correct |
4 |
Correct |
112 ms |
190048 KB |
Output is correct |
5 |
Correct |
112 ms |
190052 KB |
Output is correct |
6 |
Incorrect |
115 ms |
190052 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
109 ms |
190072 KB |
Output is correct |
2 |
Correct |
119 ms |
190128 KB |
Output is correct |
3 |
Correct |
106 ms |
190072 KB |
Output is correct |
4 |
Correct |
108 ms |
190048 KB |
Output is correct |
5 |
Correct |
112 ms |
190072 KB |
Output is correct |
6 |
Incorrect |
108 ms |
190072 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
116 ms |
190176 KB |
Output is correct |
2 |
Correct |
118 ms |
190100 KB |
Output is correct |
3 |
Correct |
111 ms |
190104 KB |
Output is correct |
4 |
Correct |
113 ms |
190072 KB |
Output is correct |
5 |
Correct |
110 ms |
190072 KB |
Output is correct |
6 |
Incorrect |
125 ms |
190196 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
123 ms |
190072 KB |
Output is correct |
2 |
Correct |
117 ms |
190072 KB |
Output is correct |
3 |
Correct |
105 ms |
190072 KB |
Output is correct |
4 |
Correct |
111 ms |
190072 KB |
Output is correct |
5 |
Correct |
106 ms |
190072 KB |
Output is correct |
6 |
Incorrect |
107 ms |
190072 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
108 ms |
190072 KB |
Output is correct |
2 |
Correct |
107 ms |
190076 KB |
Output is correct |
3 |
Correct |
105 ms |
190072 KB |
Output is correct |
4 |
Correct |
107 ms |
190072 KB |
Output is correct |
5 |
Correct |
104 ms |
190072 KB |
Output is correct |
6 |
Incorrect |
105 ms |
190072 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |