#include <bits/stdc++.h>
#define int long long
using namespace std;
int ret;
int n,a,b;
int y[2005];
int f[2005][2005];
signed main(){
ios_base::sync_with_stdio(false),cin.tie(0);
//freopen("SCULPTURES.inp","r",stdin);
cin>>n>>a>>b;
for(int i=1;i<=n;++i) cin>>y[i];
for(int i=40;i>=0;--i){
memset(f,0,sizeof (f));
f[1][1]=1;
for(int j=1;j<=n;++j){
for(int k=1;k<=b;++k) if(f[j][k]) {
int cur=0;
for(int t=j;t<=n;++t){
cur+=y[t];
if(((cur>>(i+1))|ret)==ret && !((cur>>i)&1)){
f[t+1][k+1]=1;
}
}
}
}
ret<<=1;
int ok=0;
for(int j=a;j<=b;++j) ok=ok||f[n+1][j+1];
ret+=!ok;
}
cout<<ret<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
329 ms |
31864 KB |
Output is correct |
2 |
Correct |
333 ms |
31864 KB |
Output is correct |
3 |
Correct |
320 ms |
31864 KB |
Output is correct |
4 |
Correct |
315 ms |
31864 KB |
Output is correct |
5 |
Correct |
319 ms |
31964 KB |
Output is correct |
6 |
Correct |
320 ms |
31864 KB |
Output is correct |
7 |
Correct |
322 ms |
31992 KB |
Output is correct |
8 |
Correct |
359 ms |
31872 KB |
Output is correct |
9 |
Correct |
336 ms |
31964 KB |
Output is correct |
10 |
Correct |
318 ms |
31864 KB |
Output is correct |
11 |
Correct |
343 ms |
31864 KB |
Output is correct |
12 |
Correct |
318 ms |
31864 KB |
Output is correct |
13 |
Correct |
348 ms |
31736 KB |
Output is correct |
14 |
Correct |
321 ms |
31872 KB |
Output is correct |
15 |
Correct |
315 ms |
31964 KB |
Output is correct |
16 |
Correct |
331 ms |
31864 KB |
Output is correct |
17 |
Correct |
344 ms |
31864 KB |
Output is correct |
18 |
Correct |
324 ms |
31868 KB |
Output is correct |
19 |
Correct |
324 ms |
31864 KB |
Output is correct |
20 |
Correct |
342 ms |
31788 KB |
Output is correct |
21 |
Correct |
306 ms |
31864 KB |
Output is correct |
22 |
Correct |
303 ms |
31744 KB |
Output is correct |
23 |
Correct |
311 ms |
31992 KB |
Output is correct |
24 |
Correct |
315 ms |
31864 KB |
Output is correct |
25 |
Correct |
335 ms |
31864 KB |
Output is correct |
26 |
Correct |
322 ms |
31864 KB |
Output is correct |
27 |
Correct |
316 ms |
31736 KB |
Output is correct |
28 |
Correct |
355 ms |
31744 KB |
Output is correct |
29 |
Correct |
348 ms |
31864 KB |
Output is correct |
30 |
Correct |
343 ms |
31864 KB |
Output is correct |
31 |
Correct |
332 ms |
31864 KB |
Output is correct |
32 |
Correct |
334 ms |
31964 KB |
Output is correct |
33 |
Correct |
344 ms |
31872 KB |
Output is correct |
34 |
Correct |
328 ms |
31992 KB |
Output is correct |
35 |
Correct |
314 ms |
31864 KB |
Output is correct |
36 |
Correct |
319 ms |
31992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
330 ms |
31744 KB |
Output is correct |
2 |
Correct |
327 ms |
31864 KB |
Output is correct |
3 |
Correct |
307 ms |
32000 KB |
Output is correct |
4 |
Correct |
341 ms |
31868 KB |
Output is correct |
5 |
Correct |
343 ms |
31872 KB |
Output is correct |
6 |
Correct |
341 ms |
31872 KB |
Output is correct |
7 |
Correct |
313 ms |
31868 KB |
Output is correct |
8 |
Correct |
308 ms |
31744 KB |
Output is correct |
9 |
Correct |
308 ms |
31864 KB |
Output is correct |
10 |
Correct |
318 ms |
31964 KB |
Output is correct |
11 |
Correct |
324 ms |
31868 KB |
Output is correct |
12 |
Correct |
344 ms |
31888 KB |
Output is correct |
13 |
Correct |
337 ms |
31852 KB |
Output is correct |
14 |
Correct |
318 ms |
31872 KB |
Output is correct |
15 |
Correct |
336 ms |
31868 KB |
Output is correct |
16 |
Correct |
339 ms |
31872 KB |
Output is correct |
17 |
Correct |
326 ms |
31864 KB |
Output is correct |
18 |
Correct |
309 ms |
31864 KB |
Output is correct |
19 |
Correct |
312 ms |
31884 KB |
Output is correct |
20 |
Correct |
315 ms |
31992 KB |
Output is correct |
21 |
Correct |
346 ms |
31872 KB |
Output is correct |
22 |
Correct |
336 ms |
31736 KB |
Output is correct |
23 |
Correct |
326 ms |
31996 KB |
Output is correct |
24 |
Correct |
336 ms |
31864 KB |
Output is correct |
25 |
Correct |
334 ms |
31872 KB |
Output is correct |
26 |
Correct |
353 ms |
31992 KB |
Output is correct |
27 |
Correct |
357 ms |
31864 KB |
Output is correct |
28 |
Correct |
352 ms |
31864 KB |
Output is correct |
29 |
Correct |
325 ms |
31872 KB |
Output is correct |
30 |
Correct |
344 ms |
31872 KB |
Output is correct |
31 |
Correct |
346 ms |
31992 KB |
Output is correct |
32 |
Correct |
346 ms |
31952 KB |
Output is correct |
33 |
Correct |
335 ms |
31744 KB |
Output is correct |
34 |
Correct |
325 ms |
31892 KB |
Output is correct |
35 |
Correct |
347 ms |
31864 KB |
Output is correct |
36 |
Correct |
324 ms |
31868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
338 ms |
31864 KB |
Output is correct |
2 |
Correct |
325 ms |
31880 KB |
Output is correct |
3 |
Correct |
306 ms |
31884 KB |
Output is correct |
4 |
Correct |
324 ms |
31992 KB |
Output is correct |
5 |
Correct |
336 ms |
31944 KB |
Output is correct |
6 |
Correct |
314 ms |
31968 KB |
Output is correct |
7 |
Correct |
321 ms |
31844 KB |
Output is correct |
8 |
Correct |
311 ms |
31992 KB |
Output is correct |
9 |
Correct |
320 ms |
31864 KB |
Output is correct |
10 |
Correct |
358 ms |
31864 KB |
Output is correct |
11 |
Correct |
368 ms |
31848 KB |
Output is correct |
12 |
Correct |
381 ms |
31864 KB |
Output is correct |
13 |
Correct |
332 ms |
31864 KB |
Output is correct |
14 |
Correct |
324 ms |
31844 KB |
Output is correct |
15 |
Correct |
342 ms |
31864 KB |
Output is correct |
16 |
Correct |
328 ms |
31992 KB |
Output is correct |
17 |
Correct |
320 ms |
31864 KB |
Output is correct |
18 |
Correct |
312 ms |
31864 KB |
Output is correct |
19 |
Correct |
339 ms |
31864 KB |
Output is correct |
20 |
Correct |
322 ms |
31872 KB |
Output is correct |
21 |
Correct |
313 ms |
31864 KB |
Output is correct |
22 |
Correct |
315 ms |
31736 KB |
Output is correct |
23 |
Correct |
352 ms |
31864 KB |
Output is correct |
24 |
Correct |
338 ms |
31872 KB |
Output is correct |
25 |
Correct |
317 ms |
31964 KB |
Output is correct |
26 |
Correct |
324 ms |
31872 KB |
Output is correct |
27 |
Correct |
342 ms |
31992 KB |
Output is correct |
28 |
Correct |
347 ms |
31864 KB |
Output is correct |
29 |
Correct |
345 ms |
31752 KB |
Output is correct |
30 |
Correct |
369 ms |
31964 KB |
Output is correct |
31 |
Correct |
345 ms |
31864 KB |
Output is correct |
32 |
Correct |
386 ms |
31864 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
343 ms |
31908 KB |
Output is correct |
2 |
Correct |
315 ms |
31848 KB |
Output is correct |
3 |
Correct |
313 ms |
31964 KB |
Output is correct |
4 |
Correct |
318 ms |
32000 KB |
Output is correct |
5 |
Correct |
351 ms |
31872 KB |
Output is correct |
6 |
Correct |
368 ms |
31992 KB |
Output is correct |
7 |
Correct |
326 ms |
31864 KB |
Output is correct |
8 |
Correct |
312 ms |
31864 KB |
Output is correct |
9 |
Correct |
337 ms |
31872 KB |
Output is correct |
10 |
Correct |
370 ms |
31736 KB |
Output is correct |
11 |
Correct |
333 ms |
31872 KB |
Output is correct |
12 |
Correct |
330 ms |
31872 KB |
Output is correct |
13 |
Correct |
413 ms |
31872 KB |
Output is correct |
14 |
Correct |
324 ms |
31736 KB |
Output is correct |
15 |
Correct |
368 ms |
31736 KB |
Output is correct |
16 |
Correct |
377 ms |
31736 KB |
Output is correct |
17 |
Correct |
345 ms |
31992 KB |
Output is correct |
18 |
Correct |
325 ms |
31864 KB |
Output is correct |
19 |
Correct |
322 ms |
31868 KB |
Output is correct |
20 |
Correct |
323 ms |
31864 KB |
Output is correct |
21 |
Correct |
330 ms |
31864 KB |
Output is correct |
22 |
Correct |
324 ms |
31992 KB |
Output is correct |
23 |
Correct |
318 ms |
31872 KB |
Output is correct |
24 |
Correct |
319 ms |
31872 KB |
Output is correct |
25 |
Correct |
321 ms |
31964 KB |
Output is correct |
26 |
Correct |
309 ms |
31872 KB |
Output is correct |
27 |
Correct |
312 ms |
31872 KB |
Output is correct |
28 |
Correct |
311 ms |
31872 KB |
Output is correct |
29 |
Correct |
372 ms |
31864 KB |
Output is correct |
30 |
Correct |
331 ms |
31864 KB |
Output is correct |
31 |
Correct |
346 ms |
31868 KB |
Output is correct |
32 |
Correct |
351 ms |
31744 KB |
Output is correct |
33 |
Correct |
350 ms |
31864 KB |
Output is correct |
34 |
Correct |
324 ms |
31864 KB |
Output is correct |
35 |
Correct |
357 ms |
31992 KB |
Output is correct |
36 |
Correct |
348 ms |
31864 KB |
Output is correct |
37 |
Correct |
334 ms |
31864 KB |
Output is correct |
38 |
Correct |
325 ms |
31864 KB |
Output is correct |
39 |
Correct |
345 ms |
31864 KB |
Output is correct |
40 |
Correct |
344 ms |
31872 KB |
Output is correct |
41 |
Correct |
355 ms |
31864 KB |
Output is correct |
42 |
Correct |
330 ms |
31736 KB |
Output is correct |
43 |
Correct |
343 ms |
31864 KB |
Output is correct |
44 |
Correct |
350 ms |
31964 KB |
Output is correct |
45 |
Correct |
368 ms |
31864 KB |
Output is correct |
46 |
Correct |
347 ms |
31872 KB |
Output is correct |
47 |
Correct |
367 ms |
31872 KB |
Output is correct |
48 |
Correct |
345 ms |
31888 KB |
Output is correct |
49 |
Correct |
337 ms |
31872 KB |
Output is correct |
50 |
Correct |
332 ms |
31996 KB |
Output is correct |
51 |
Correct |
372 ms |
31864 KB |
Output is correct |
52 |
Correct |
341 ms |
31872 KB |
Output is correct |
53 |
Correct |
305 ms |
31968 KB |
Output is correct |
54 |
Correct |
335 ms |
31864 KB |
Output is correct |
55 |
Correct |
350 ms |
31992 KB |
Output is correct |
56 |
Correct |
324 ms |
31964 KB |
Output is correct |
57 |
Correct |
321 ms |
31848 KB |
Output is correct |
58 |
Correct |
315 ms |
31864 KB |
Output is correct |
59 |
Correct |
337 ms |
31864 KB |
Output is correct |
60 |
Correct |
358 ms |
31844 KB |
Output is correct |
61 |
Correct |
316 ms |
31864 KB |
Output is correct |
62 |
Correct |
312 ms |
31864 KB |
Output is correct |
63 |
Correct |
315 ms |
31872 KB |
Output is correct |
64 |
Correct |
321 ms |
31868 KB |
Output is correct |
65 |
Correct |
328 ms |
31992 KB |
Output is correct |
66 |
Correct |
314 ms |
31964 KB |
Output is correct |
67 |
Correct |
317 ms |
31864 KB |
Output is correct |
68 |
Correct |
320 ms |
31992 KB |
Output is correct |
69 |
Correct |
326 ms |
31992 KB |
Output is correct |
70 |
Correct |
339 ms |
31964 KB |
Output is correct |
71 |
Correct |
308 ms |
31740 KB |
Output is correct |
72 |
Correct |
312 ms |
31864 KB |
Output is correct |
73 |
Correct |
364 ms |
31964 KB |
Output is correct |
74 |
Correct |
321 ms |
31736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
316 ms |
31864 KB |
Output is correct |
2 |
Correct |
318 ms |
31992 KB |
Output is correct |
3 |
Correct |
355 ms |
31872 KB |
Output is correct |
4 |
Correct |
315 ms |
31872 KB |
Output is correct |
5 |
Correct |
323 ms |
31744 KB |
Output is correct |
6 |
Correct |
323 ms |
31736 KB |
Output is correct |
7 |
Correct |
358 ms |
31872 KB |
Output is correct |
8 |
Correct |
378 ms |
31836 KB |
Output is correct |
9 |
Correct |
336 ms |
31864 KB |
Output is correct |
10 |
Correct |
316 ms |
31864 KB |
Output is correct |
11 |
Correct |
322 ms |
31864 KB |
Output is correct |
12 |
Correct |
330 ms |
31744 KB |
Output is correct |
13 |
Correct |
317 ms |
31872 KB |
Output is correct |
14 |
Correct |
332 ms |
31968 KB |
Output is correct |
15 |
Correct |
359 ms |
31868 KB |
Output is correct |
16 |
Correct |
379 ms |
31864 KB |
Output is correct |
17 |
Correct |
362 ms |
31864 KB |
Output is correct |
18 |
Correct |
350 ms |
31992 KB |
Output is correct |
19 |
Correct |
311 ms |
31864 KB |
Output is correct |
20 |
Correct |
318 ms |
31864 KB |
Output is correct |
21 |
Correct |
346 ms |
31864 KB |
Output is correct |
22 |
Correct |
346 ms |
31972 KB |
Output is correct |
23 |
Correct |
355 ms |
31968 KB |
Output is correct |
24 |
Correct |
328 ms |
31736 KB |
Output is correct |
25 |
Correct |
357 ms |
31872 KB |
Output is correct |
26 |
Correct |
344 ms |
31992 KB |
Output is correct |
27 |
Correct |
323 ms |
31992 KB |
Output is correct |
28 |
Correct |
359 ms |
32052 KB |
Output is correct |
29 |
Correct |
343 ms |
31992 KB |
Output is correct |
30 |
Correct |
368 ms |
31872 KB |
Output is correct |
31 |
Correct |
344 ms |
31864 KB |
Output is correct |
32 |
Correct |
347 ms |
31992 KB |
Output is correct |
33 |
Correct |
342 ms |
31744 KB |
Output is correct |
34 |
Correct |
344 ms |
31964 KB |
Output is correct |
35 |
Correct |
336 ms |
31892 KB |
Output is correct |
36 |
Correct |
344 ms |
31968 KB |
Output is correct |
37 |
Correct |
341 ms |
31992 KB |
Output is correct |
38 |
Correct |
327 ms |
31860 KB |
Output is correct |
39 |
Correct |
352 ms |
32068 KB |
Output is correct |
40 |
Correct |
324 ms |
31872 KB |
Output is correct |
41 |
Correct |
330 ms |
31872 KB |
Output is correct |
42 |
Correct |
373 ms |
31872 KB |
Output is correct |
43 |
Correct |
334 ms |
31864 KB |
Output is correct |
44 |
Correct |
342 ms |
31964 KB |
Output is correct |
45 |
Correct |
318 ms |
31852 KB |
Output is correct |
46 |
Correct |
324 ms |
31744 KB |
Output is correct |
47 |
Correct |
331 ms |
31848 KB |
Output is correct |
48 |
Correct |
324 ms |
31744 KB |
Output is correct |
49 |
Correct |
333 ms |
31992 KB |
Output is correct |
50 |
Correct |
324 ms |
31864 KB |
Output is correct |
51 |
Correct |
329 ms |
31844 KB |
Output is correct |
52 |
Correct |
672 ms |
31872 KB |
Output is correct |
53 |
Execution timed out |
1077 ms |
31740 KB |
Time limit exceeded |
54 |
Halted |
0 ms |
0 KB |
- |