#include <bits/stdc++.h>
using namespace std;
const int N=55,B=22,O=522,MX=1e9+9;
int n,x,y,a[N],pre[N],dp[N][O][B];
int solve(int pos,int OR,int parts){
if(pos==n+1)
return (parts>=x && parts<=y?OR:MX);
int &ret=dp[pos][OR][parts];
if(ret!=-1)
return ret;
ret=MX;
for(int i=pos;i<=n;i++)
ret=min(ret,solve(i+1,OR|(pre[i]-pre[pos-1]),parts+1));
return ret;
}
int main(){
cin>>n>>x>>y;
for(int i=1;i<=n;i++)
cin>>a[i],pre[i]=a[i]+pre[i-1];
memset(dp,-1,sizeof(dp));
cout<<solve(1,0,0)<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2816 KB |
Output is correct |
2 |
Correct |
16 ms |
2816 KB |
Output is correct |
3 |
Correct |
4 ms |
2816 KB |
Output is correct |
4 |
Correct |
4 ms |
2816 KB |
Output is correct |
5 |
Correct |
4 ms |
2816 KB |
Output is correct |
6 |
Correct |
4 ms |
2816 KB |
Output is correct |
7 |
Correct |
3 ms |
2816 KB |
Output is correct |
8 |
Correct |
4 ms |
2816 KB |
Output is correct |
9 |
Correct |
4 ms |
2816 KB |
Output is correct |
10 |
Correct |
3 ms |
2816 KB |
Output is correct |
11 |
Correct |
4 ms |
2816 KB |
Output is correct |
12 |
Correct |
4 ms |
2816 KB |
Output is correct |
13 |
Correct |
4 ms |
2816 KB |
Output is correct |
14 |
Correct |
4 ms |
2816 KB |
Output is correct |
15 |
Correct |
4 ms |
2816 KB |
Output is correct |
16 |
Correct |
4 ms |
2816 KB |
Output is correct |
17 |
Correct |
4 ms |
2816 KB |
Output is correct |
18 |
Correct |
4 ms |
2816 KB |
Output is correct |
19 |
Correct |
3 ms |
2816 KB |
Output is correct |
20 |
Correct |
2 ms |
2816 KB |
Output is correct |
21 |
Correct |
3 ms |
2816 KB |
Output is correct |
22 |
Correct |
4 ms |
2816 KB |
Output is correct |
23 |
Correct |
4 ms |
2816 KB |
Output is correct |
24 |
Correct |
0 ms |
2816 KB |
Output is correct |
25 |
Correct |
4 ms |
2816 KB |
Output is correct |
26 |
Correct |
5 ms |
2816 KB |
Output is correct |
27 |
Runtime error |
15 ms |
5376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2816 KB |
Output is correct |
2 |
Correct |
4 ms |
2816 KB |
Output is correct |
3 |
Correct |
3 ms |
2816 KB |
Output is correct |
4 |
Correct |
4 ms |
2816 KB |
Output is correct |
5 |
Correct |
4 ms |
2816 KB |
Output is correct |
6 |
Correct |
4 ms |
2816 KB |
Output is correct |
7 |
Correct |
4 ms |
2816 KB |
Output is correct |
8 |
Correct |
4 ms |
2816 KB |
Output is correct |
9 |
Correct |
10 ms |
2816 KB |
Output is correct |
10 |
Correct |
5 ms |
2816 KB |
Output is correct |
11 |
Correct |
4 ms |
2816 KB |
Output is correct |
12 |
Correct |
4 ms |
2816 KB |
Output is correct |
13 |
Correct |
4 ms |
2816 KB |
Output is correct |
14 |
Correct |
4 ms |
2788 KB |
Output is correct |
15 |
Correct |
3 ms |
2816 KB |
Output is correct |
16 |
Correct |
3 ms |
2816 KB |
Output is correct |
17 |
Correct |
4 ms |
2816 KB |
Output is correct |
18 |
Correct |
3 ms |
2816 KB |
Output is correct |
19 |
Correct |
3 ms |
2816 KB |
Output is correct |
20 |
Correct |
3 ms |
2816 KB |
Output is correct |
21 |
Correct |
4 ms |
2816 KB |
Output is correct |
22 |
Correct |
3 ms |
2816 KB |
Output is correct |
23 |
Correct |
4 ms |
2816 KB |
Output is correct |
24 |
Correct |
4 ms |
2816 KB |
Output is correct |
25 |
Correct |
3 ms |
2816 KB |
Output is correct |
26 |
Correct |
3 ms |
2816 KB |
Output is correct |
27 |
Correct |
4 ms |
2816 KB |
Output is correct |
28 |
Correct |
3 ms |
2816 KB |
Output is correct |
29 |
Correct |
5 ms |
2816 KB |
Output is correct |
30 |
Correct |
4 ms |
2816 KB |
Output is correct |
31 |
Correct |
6 ms |
2816 KB |
Output is correct |
32 |
Correct |
5 ms |
2816 KB |
Output is correct |
33 |
Correct |
5 ms |
2816 KB |
Output is correct |
34 |
Correct |
5 ms |
2816 KB |
Output is correct |
35 |
Correct |
5 ms |
2816 KB |
Output is correct |
36 |
Correct |
5 ms |
2816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2816 KB |
Output is correct |
2 |
Correct |
4 ms |
2816 KB |
Output is correct |
3 |
Correct |
3 ms |
2816 KB |
Output is correct |
4 |
Correct |
3 ms |
2816 KB |
Output is correct |
5 |
Correct |
4 ms |
2816 KB |
Output is correct |
6 |
Correct |
4 ms |
2816 KB |
Output is correct |
7 |
Correct |
3 ms |
2816 KB |
Output is correct |
8 |
Correct |
3 ms |
2816 KB |
Output is correct |
9 |
Correct |
4 ms |
2816 KB |
Output is correct |
10 |
Correct |
3 ms |
2816 KB |
Output is correct |
11 |
Correct |
4 ms |
2816 KB |
Output is correct |
12 |
Correct |
4 ms |
2816 KB |
Output is correct |
13 |
Correct |
4 ms |
2816 KB |
Output is correct |
14 |
Correct |
3 ms |
2816 KB |
Output is correct |
15 |
Correct |
4 ms |
2816 KB |
Output is correct |
16 |
Correct |
4 ms |
2816 KB |
Output is correct |
17 |
Correct |
4 ms |
2816 KB |
Output is correct |
18 |
Correct |
6 ms |
2816 KB |
Output is correct |
19 |
Correct |
5 ms |
2816 KB |
Output is correct |
20 |
Correct |
5 ms |
2816 KB |
Output is correct |
21 |
Correct |
5 ms |
2816 KB |
Output is correct |
22 |
Correct |
5 ms |
2816 KB |
Output is correct |
23 |
Correct |
5 ms |
2816 KB |
Output is correct |
24 |
Correct |
6 ms |
2816 KB |
Output is correct |
25 |
Incorrect |
4 ms |
2816 KB |
Output isn't correct |
26 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2816 KB |
Output is correct |
2 |
Correct |
3 ms |
2816 KB |
Output is correct |
3 |
Correct |
3 ms |
2816 KB |
Output is correct |
4 |
Correct |
4 ms |
2816 KB |
Output is correct |
5 |
Correct |
4 ms |
2816 KB |
Output is correct |
6 |
Correct |
4 ms |
2816 KB |
Output is correct |
7 |
Correct |
4 ms |
2816 KB |
Output is correct |
8 |
Correct |
5 ms |
2816 KB |
Output is correct |
9 |
Correct |
4 ms |
2816 KB |
Output is correct |
10 |
Correct |
4 ms |
2816 KB |
Output is correct |
11 |
Correct |
3 ms |
2816 KB |
Output is correct |
12 |
Correct |
4 ms |
2788 KB |
Output is correct |
13 |
Correct |
4 ms |
2816 KB |
Output is correct |
14 |
Correct |
4 ms |
2816 KB |
Output is correct |
15 |
Correct |
4 ms |
2816 KB |
Output is correct |
16 |
Correct |
3 ms |
2816 KB |
Output is correct |
17 |
Correct |
3 ms |
2816 KB |
Output is correct |
18 |
Correct |
3 ms |
2816 KB |
Output is correct |
19 |
Correct |
4 ms |
2816 KB |
Output is correct |
20 |
Correct |
3 ms |
2816 KB |
Output is correct |
21 |
Correct |
4 ms |
2816 KB |
Output is correct |
22 |
Correct |
3 ms |
2816 KB |
Output is correct |
23 |
Correct |
3 ms |
2816 KB |
Output is correct |
24 |
Correct |
3 ms |
2816 KB |
Output is correct |
25 |
Correct |
4 ms |
2816 KB |
Output is correct |
26 |
Correct |
4 ms |
2816 KB |
Output is correct |
27 |
Runtime error |
7 ms |
5376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2816 KB |
Output is correct |
2 |
Correct |
3 ms |
2816 KB |
Output is correct |
3 |
Correct |
4 ms |
2816 KB |
Output is correct |
4 |
Correct |
4 ms |
2816 KB |
Output is correct |
5 |
Correct |
4 ms |
2816 KB |
Output is correct |
6 |
Correct |
3 ms |
2816 KB |
Output is correct |
7 |
Correct |
4 ms |
2816 KB |
Output is correct |
8 |
Correct |
4 ms |
2816 KB |
Output is correct |
9 |
Correct |
4 ms |
2816 KB |
Output is correct |
10 |
Correct |
4 ms |
2816 KB |
Output is correct |
11 |
Correct |
4 ms |
2816 KB |
Output is correct |
12 |
Correct |
3 ms |
2844 KB |
Output is correct |
13 |
Correct |
4 ms |
2816 KB |
Output is correct |
14 |
Runtime error |
6 ms |
5504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Halted |
0 ms |
0 KB |
- |