#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=103;
const int MASK=(1<<14);
bool check[N][MASK][N];
const int inf=1e9+7;
int get_mask(int x,int y)
{
return (x>>y)&1;
}
int main()
{
int n,need_x,need_y;
cin>>n>>need_x>>need_y;
vector<int>a(n+1);
for(int i=1;i<=n;i++)cin>>a[i];
vector<int>sum(n+1);
for(int i=1;i<=n;i++)sum[i]=sum[i-1]+a[i];
int maxv=sum[n];
memset(check,0,sizeof(check));
check[0][0][0]=true;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
int res=sum[i]-sum[j-1];
for(int num=1;num<=need_y;num++)
{
for(int mask=0;mask<=maxv;mask++)
{
if(check[j-1][mask][num-1]==false)continue;
int value=mask|res;
check[i][value][num]=true;
//cout<<check[i][value][num]<<" "<<i<<" "<<value<<" "<<num<<endl;
}
}
}
}
int ans=inf;
for(int i=need_x;i<=need_y;i++)
{
for(int mask=0;mask<=maxv;mask++)
{
if(check[n][mask][i])ans=min(ans,mask);
}
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
170312 KB |
Output is correct |
2 |
Correct |
59 ms |
170264 KB |
Output is correct |
3 |
Correct |
68 ms |
170332 KB |
Output is correct |
4 |
Correct |
60 ms |
170296 KB |
Output is correct |
5 |
Correct |
74 ms |
170232 KB |
Output is correct |
6 |
Correct |
64 ms |
170280 KB |
Output is correct |
7 |
Correct |
61 ms |
170280 KB |
Output is correct |
8 |
Correct |
61 ms |
170308 KB |
Output is correct |
9 |
Correct |
61 ms |
170232 KB |
Output is correct |
10 |
Correct |
62 ms |
170344 KB |
Output is correct |
11 |
Correct |
61 ms |
170300 KB |
Output is correct |
12 |
Correct |
61 ms |
170308 KB |
Output is correct |
13 |
Correct |
62 ms |
170308 KB |
Output is correct |
14 |
Correct |
60 ms |
170308 KB |
Output is correct |
15 |
Correct |
60 ms |
170296 KB |
Output is correct |
16 |
Correct |
63 ms |
170316 KB |
Output is correct |
17 |
Correct |
72 ms |
170260 KB |
Output is correct |
18 |
Correct |
67 ms |
170256 KB |
Output is correct |
19 |
Correct |
64 ms |
170328 KB |
Output is correct |
20 |
Correct |
62 ms |
170232 KB |
Output is correct |
21 |
Correct |
66 ms |
170332 KB |
Output is correct |
22 |
Correct |
63 ms |
170256 KB |
Output is correct |
23 |
Correct |
61 ms |
170328 KB |
Output is correct |
24 |
Correct |
60 ms |
170236 KB |
Output is correct |
25 |
Correct |
61 ms |
170288 KB |
Output is correct |
26 |
Correct |
61 ms |
170252 KB |
Output is correct |
27 |
Incorrect |
61 ms |
170352 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
170332 KB |
Output is correct |
2 |
Correct |
75 ms |
170332 KB |
Output is correct |
3 |
Correct |
64 ms |
170268 KB |
Output is correct |
4 |
Correct |
61 ms |
170264 KB |
Output is correct |
5 |
Correct |
60 ms |
170260 KB |
Output is correct |
6 |
Correct |
62 ms |
170272 KB |
Output is correct |
7 |
Correct |
60 ms |
170256 KB |
Output is correct |
8 |
Correct |
61 ms |
170316 KB |
Output is correct |
9 |
Correct |
65 ms |
170416 KB |
Output is correct |
10 |
Correct |
62 ms |
170264 KB |
Output is correct |
11 |
Correct |
62 ms |
170308 KB |
Output is correct |
12 |
Correct |
61 ms |
170308 KB |
Output is correct |
13 |
Correct |
64 ms |
170272 KB |
Output is correct |
14 |
Correct |
65 ms |
170288 KB |
Output is correct |
15 |
Correct |
61 ms |
170308 KB |
Output is correct |
16 |
Correct |
61 ms |
170440 KB |
Output is correct |
17 |
Correct |
61 ms |
170272 KB |
Output is correct |
18 |
Correct |
61 ms |
170248 KB |
Output is correct |
19 |
Correct |
60 ms |
170300 KB |
Output is correct |
20 |
Correct |
72 ms |
170272 KB |
Output is correct |
21 |
Correct |
77 ms |
170268 KB |
Output is correct |
22 |
Correct |
62 ms |
170248 KB |
Output is correct |
23 |
Correct |
64 ms |
170328 KB |
Output is correct |
24 |
Correct |
60 ms |
170408 KB |
Output is correct |
25 |
Correct |
61 ms |
170328 KB |
Output is correct |
26 |
Correct |
61 ms |
170308 KB |
Output is correct |
27 |
Correct |
62 ms |
170324 KB |
Output is correct |
28 |
Correct |
70 ms |
170324 KB |
Output is correct |
29 |
Correct |
66 ms |
170284 KB |
Output is correct |
30 |
Correct |
66 ms |
170232 KB |
Output is correct |
31 |
Correct |
73 ms |
170348 KB |
Output is correct |
32 |
Correct |
79 ms |
170260 KB |
Output is correct |
33 |
Correct |
62 ms |
170256 KB |
Output is correct |
34 |
Correct |
71 ms |
170352 KB |
Output is correct |
35 |
Correct |
69 ms |
170264 KB |
Output is correct |
36 |
Correct |
64 ms |
170360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
170236 KB |
Output is correct |
2 |
Correct |
65 ms |
170228 KB |
Output is correct |
3 |
Correct |
61 ms |
170344 KB |
Output is correct |
4 |
Correct |
64 ms |
170272 KB |
Output is correct |
5 |
Correct |
61 ms |
170228 KB |
Output is correct |
6 |
Correct |
60 ms |
170324 KB |
Output is correct |
7 |
Correct |
61 ms |
170260 KB |
Output is correct |
8 |
Correct |
63 ms |
170344 KB |
Output is correct |
9 |
Correct |
69 ms |
170352 KB |
Output is correct |
10 |
Correct |
60 ms |
170304 KB |
Output is correct |
11 |
Correct |
70 ms |
170236 KB |
Output is correct |
12 |
Correct |
69 ms |
170288 KB |
Output is correct |
13 |
Correct |
62 ms |
170276 KB |
Output is correct |
14 |
Correct |
62 ms |
170320 KB |
Output is correct |
15 |
Correct |
62 ms |
170228 KB |
Output is correct |
16 |
Correct |
63 ms |
170324 KB |
Output is correct |
17 |
Correct |
66 ms |
170272 KB |
Output is correct |
18 |
Correct |
76 ms |
170352 KB |
Output is correct |
19 |
Correct |
84 ms |
170264 KB |
Output is correct |
20 |
Correct |
62 ms |
170260 KB |
Output is correct |
21 |
Correct |
74 ms |
170352 KB |
Output is correct |
22 |
Correct |
69 ms |
170348 KB |
Output is correct |
23 |
Correct |
68 ms |
170244 KB |
Output is correct |
24 |
Correct |
76 ms |
170316 KB |
Output is correct |
25 |
Correct |
79 ms |
170308 KB |
Output is correct |
26 |
Correct |
140 ms |
170348 KB |
Output is correct |
27 |
Correct |
329 ms |
170344 KB |
Output is correct |
28 |
Correct |
601 ms |
170352 KB |
Output is correct |
29 |
Execution timed out |
1042 ms |
170320 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
170236 KB |
Output is correct |
2 |
Correct |
67 ms |
170268 KB |
Output is correct |
3 |
Correct |
61 ms |
170280 KB |
Output is correct |
4 |
Correct |
60 ms |
170236 KB |
Output is correct |
5 |
Correct |
60 ms |
170344 KB |
Output is correct |
6 |
Correct |
60 ms |
170252 KB |
Output is correct |
7 |
Correct |
79 ms |
170316 KB |
Output is correct |
8 |
Correct |
61 ms |
170388 KB |
Output is correct |
9 |
Correct |
61 ms |
170296 KB |
Output is correct |
10 |
Correct |
60 ms |
170268 KB |
Output is correct |
11 |
Correct |
61 ms |
170308 KB |
Output is correct |
12 |
Correct |
61 ms |
170340 KB |
Output is correct |
13 |
Correct |
70 ms |
170316 KB |
Output is correct |
14 |
Correct |
78 ms |
170284 KB |
Output is correct |
15 |
Correct |
72 ms |
170304 KB |
Output is correct |
16 |
Correct |
64 ms |
170308 KB |
Output is correct |
17 |
Correct |
60 ms |
170304 KB |
Output is correct |
18 |
Correct |
61 ms |
170348 KB |
Output is correct |
19 |
Correct |
61 ms |
170276 KB |
Output is correct |
20 |
Correct |
61 ms |
170276 KB |
Output is correct |
21 |
Correct |
61 ms |
170236 KB |
Output is correct |
22 |
Correct |
64 ms |
170316 KB |
Output is correct |
23 |
Correct |
78 ms |
170340 KB |
Output is correct |
24 |
Correct |
61 ms |
170328 KB |
Output is correct |
25 |
Correct |
60 ms |
170264 KB |
Output is correct |
26 |
Correct |
63 ms |
170268 KB |
Output is correct |
27 |
Incorrect |
61 ms |
170348 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
170252 KB |
Output is correct |
2 |
Correct |
61 ms |
170308 KB |
Output is correct |
3 |
Correct |
62 ms |
170308 KB |
Output is correct |
4 |
Correct |
63 ms |
170312 KB |
Output is correct |
5 |
Correct |
63 ms |
170336 KB |
Output is correct |
6 |
Correct |
79 ms |
170232 KB |
Output is correct |
7 |
Correct |
64 ms |
170336 KB |
Output is correct |
8 |
Correct |
61 ms |
170264 KB |
Output is correct |
9 |
Correct |
64 ms |
170260 KB |
Output is correct |
10 |
Correct |
71 ms |
170276 KB |
Output is correct |
11 |
Correct |
64 ms |
170308 KB |
Output is correct |
12 |
Correct |
64 ms |
170308 KB |
Output is correct |
13 |
Correct |
71 ms |
170284 KB |
Output is correct |
14 |
Incorrect |
61 ms |
170296 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |