# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42102 | 2018-02-22T13:34:53 Z | minchurl | Bali Sculptures (APIO15_sculpture) | C++11 | 249 ms | 876 KB |
#include<bits/stdc++.h> #define MAX_N 2005 #define inf (1LL<<62) #define LL long long using namespace std; LL n,a,b,ans,arr[MAX_N]; LL t[MAX_N]; bool ct[MAX_N][MAX_N]; bool case1(LL x){ LL i,j,sum,test,y,z,k,l; bool p=false; y=inf-1;y-=(1LL<<x)-1; z=ans&y; for(i=0;i<=n;i++) for(j=0;j<=n;j++) ct[i][j]=false; ct[0][0]=true; for(l=1;l<=b;l++){ for(i=1;i<=n;i++){ sum=0; for(j=i;j>=1;j--){ sum+=arr[j]; k=sum&y; if((z|k)==z) ct[l][i]|=ct[l-1][j-1]; } if(l>=a) p|=ct[l][n]; } } return p; } bool is_ok(LL x){ LL i,j,sum,test,y,z,k; y=inf-1;y-=(1LL<<x)-1; z=ans&y; for(i=1;i<=n;i++) t[i]=inf; t[0]=0; for(i=1;i<=n;i++){ sum=0; for(j=i;j>=1;j--){ sum+=arr[j]; k=sum&y; if((z|k)==z) t[i]=min(t[i],t[j-1]+1); } } return t[n]<=b; } int main(){ LL i,x; scanf("%lld",&n); scanf("%lld %lld",&a,&b); for(i=1;i<=n;i++) scanf("%lld",&arr[i]); if(n<=100){ans=0;for(i=60;i>=0;i--) ans|=case1(i)?0LL:(1LL<<i);} else{ans=0;for(i=60;i>=0;i--) ans|=is_ok(i)?0LL:(1LL<<i);} printf("%lld\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 472 KB | Output is correct |
4 | Correct | 1 ms | 544 KB | Output is correct |
5 | Correct | 1 ms | 544 KB | Output is correct |
6 | Correct | 2 ms | 544 KB | Output is correct |
7 | Correct | 2 ms | 548 KB | Output is correct |
8 | Correct | 1 ms | 548 KB | Output is correct |
9 | Correct | 2 ms | 600 KB | Output is correct |
10 | Correct | 2 ms | 620 KB | Output is correct |
11 | Correct | 2 ms | 620 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 2 ms | 620 KB | Output is correct |
14 | Correct | 1 ms | 620 KB | Output is correct |
15 | Correct | 1 ms | 620 KB | Output is correct |
16 | Correct | 1 ms | 620 KB | Output is correct |
17 | Correct | 2 ms | 620 KB | Output is correct |
18 | Correct | 1 ms | 620 KB | Output is correct |
19 | Correct | 2 ms | 620 KB | Output is correct |
20 | Correct | 2 ms | 620 KB | Output is correct |
21 | Correct | 2 ms | 620 KB | Output is correct |
22 | Correct | 2 ms | 620 KB | Output is correct |
23 | Correct | 2 ms | 620 KB | Output is correct |
24 | Correct | 2 ms | 620 KB | Output is correct |
25 | Correct | 2 ms | 620 KB | Output is correct |
26 | Correct | 2 ms | 620 KB | Output is correct |
27 | Correct | 2 ms | 620 KB | Output is correct |
28 | Correct | 1 ms | 620 KB | Output is correct |
29 | Correct | 2 ms | 624 KB | Output is correct |
30 | Correct | 2 ms | 624 KB | Output is correct |
31 | Correct | 2 ms | 624 KB | Output is correct |
32 | Correct | 2 ms | 624 KB | Output is correct |
33 | Correct | 2 ms | 624 KB | Output is correct |
34 | Correct | 2 ms | 624 KB | Output is correct |
35 | Correct | 2 ms | 624 KB | Output is correct |
36 | Correct | 2 ms | 624 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 624 KB | Output is correct |
2 | Correct | 2 ms | 624 KB | Output is correct |
3 | Correct | 2 ms | 624 KB | Output is correct |
4 | Correct | 2 ms | 624 KB | Output is correct |
5 | Correct | 2 ms | 624 KB | Output is correct |
6 | Correct | 2 ms | 624 KB | Output is correct |
7 | Correct | 2 ms | 624 KB | Output is correct |
8 | Correct | 2 ms | 624 KB | Output is correct |
9 | Correct | 1 ms | 624 KB | Output is correct |
10 | Correct | 2 ms | 624 KB | Output is correct |
11 | Correct | 2 ms | 624 KB | Output is correct |
12 | Correct | 2 ms | 624 KB | Output is correct |
13 | Correct | 2 ms | 624 KB | Output is correct |
14 | Correct | 2 ms | 624 KB | Output is correct |
15 | Correct | 2 ms | 624 KB | Output is correct |
16 | Correct | 1 ms | 624 KB | Output is correct |
17 | Correct | 1 ms | 624 KB | Output is correct |
18 | Correct | 2 ms | 624 KB | Output is correct |
19 | Correct | 2 ms | 624 KB | Output is correct |
20 | Correct | 2 ms | 624 KB | Output is correct |
21 | Correct | 2 ms | 624 KB | Output is correct |
22 | Correct | 2 ms | 624 KB | Output is correct |
23 | Correct | 2 ms | 624 KB | Output is correct |
24 | Correct | 2 ms | 624 KB | Output is correct |
25 | Correct | 2 ms | 624 KB | Output is correct |
26 | Correct | 2 ms | 624 KB | Output is correct |
27 | Correct | 2 ms | 624 KB | Output is correct |
28 | Correct | 2 ms | 624 KB | Output is correct |
29 | Correct | 3 ms | 696 KB | Output is correct |
30 | Correct | 4 ms | 696 KB | Output is correct |
31 | Correct | 5 ms | 696 KB | Output is correct |
32 | Correct | 5 ms | 696 KB | Output is correct |
33 | Correct | 2 ms | 748 KB | Output is correct |
34 | Correct | 5 ms | 748 KB | Output is correct |
35 | Correct | 4 ms | 748 KB | Output is correct |
36 | Correct | 3 ms | 748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 748 KB | Output is correct |
2 | Correct | 1 ms | 748 KB | Output is correct |
3 | Correct | 2 ms | 748 KB | Output is correct |
4 | Correct | 2 ms | 748 KB | Output is correct |
5 | Correct | 1 ms | 748 KB | Output is correct |
6 | Correct | 2 ms | 748 KB | Output is correct |
7 | Correct | 2 ms | 748 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 2 ms | 748 KB | Output is correct |
11 | Correct | 1 ms | 748 KB | Output is correct |
12 | Correct | 2 ms | 748 KB | Output is correct |
13 | Correct | 2 ms | 748 KB | Output is correct |
14 | Correct | 2 ms | 748 KB | Output is correct |
15 | Correct | 2 ms | 748 KB | Output is correct |
16 | Correct | 2 ms | 748 KB | Output is correct |
17 | Correct | 4 ms | 748 KB | Output is correct |
18 | Correct | 6 ms | 748 KB | Output is correct |
19 | Correct | 5 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 5 ms | 748 KB | Output is correct |
22 | Correct | 4 ms | 748 KB | Output is correct |
23 | Correct | 3 ms | 748 KB | Output is correct |
24 | Correct | 5 ms | 748 KB | Output is correct |
25 | Correct | 5 ms | 748 KB | Output is correct |
26 | Correct | 11 ms | 748 KB | Output is correct |
27 | Correct | 38 ms | 748 KB | Output is correct |
28 | Correct | 69 ms | 748 KB | Output is correct |
29 | Correct | 72 ms | 748 KB | Output is correct |
30 | Correct | 4 ms | 748 KB | Output is correct |
31 | Correct | 37 ms | 748 KB | Output is correct |
32 | Correct | 59 ms | 748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 748 KB | Output is correct |
2 | Correct | 1 ms | 748 KB | Output is correct |
3 | Correct | 1 ms | 748 KB | Output is correct |
4 | Correct | 1 ms | 748 KB | Output is correct |
5 | Correct | 2 ms | 748 KB | Output is correct |
6 | Correct | 2 ms | 748 KB | Output is correct |
7 | Correct | 2 ms | 748 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 2 ms | 748 KB | Output is correct |
11 | Correct | 2 ms | 748 KB | Output is correct |
12 | Correct | 2 ms | 748 KB | Output is correct |
13 | Correct | 2 ms | 748 KB | Output is correct |
14 | Correct | 2 ms | 748 KB | Output is correct |
15 | Correct | 2 ms | 748 KB | Output is correct |
16 | Correct | 2 ms | 748 KB | Output is correct |
17 | Correct | 2 ms | 748 KB | Output is correct |
18 | Correct | 1 ms | 748 KB | Output is correct |
19 | Correct | 2 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 2 ms | 748 KB | Output is correct |
22 | Correct | 2 ms | 748 KB | Output is correct |
23 | Correct | 2 ms | 748 KB | Output is correct |
24 | Correct | 2 ms | 748 KB | Output is correct |
25 | Correct | 2 ms | 748 KB | Output is correct |
26 | Correct | 2 ms | 748 KB | Output is correct |
27 | Correct | 1 ms | 748 KB | Output is correct |
28 | Correct | 2 ms | 748 KB | Output is correct |
29 | Correct | 2 ms | 748 KB | Output is correct |
30 | Correct | 2 ms | 748 KB | Output is correct |
31 | Correct | 2 ms | 748 KB | Output is correct |
32 | Correct | 2 ms | 748 KB | Output is correct |
33 | Correct | 2 ms | 748 KB | Output is correct |
34 | Correct | 2 ms | 748 KB | Output is correct |
35 | Correct | 2 ms | 748 KB | Output is correct |
36 | Correct | 2 ms | 748 KB | Output is correct |
37 | Correct | 3 ms | 748 KB | Output is correct |
38 | Correct | 2 ms | 748 KB | Output is correct |
39 | Correct | 2 ms | 748 KB | Output is correct |
40 | Correct | 5 ms | 748 KB | Output is correct |
41 | Correct | 7 ms | 748 KB | Output is correct |
42 | Correct | 6 ms | 748 KB | Output is correct |
43 | Correct | 2 ms | 748 KB | Output is correct |
44 | Correct | 8 ms | 748 KB | Output is correct |
45 | Correct | 7 ms | 748 KB | Output is correct |
46 | Correct | 4 ms | 748 KB | Output is correct |
47 | Correct | 5 ms | 748 KB | Output is correct |
48 | Correct | 6 ms | 748 KB | Output is correct |
49 | Correct | 12 ms | 748 KB | Output is correct |
50 | Correct | 32 ms | 748 KB | Output is correct |
51 | Correct | 81 ms | 748 KB | Output is correct |
52 | Correct | 73 ms | 808 KB | Output is correct |
53 | Correct | 4 ms | 808 KB | Output is correct |
54 | Correct | 38 ms | 808 KB | Output is correct |
55 | Correct | 66 ms | 808 KB | Output is correct |
56 | Correct | 4 ms | 808 KB | Output is correct |
57 | Correct | 10 ms | 808 KB | Output is correct |
58 | Correct | 27 ms | 808 KB | Output is correct |
59 | Correct | 64 ms | 876 KB | Output is correct |
60 | Correct | 62 ms | 876 KB | Output is correct |
61 | Correct | 3 ms | 876 KB | Output is correct |
62 | Correct | 57 ms | 876 KB | Output is correct |
63 | Correct | 66 ms | 876 KB | Output is correct |
64 | Correct | 54 ms | 876 KB | Output is correct |
65 | Correct | 5 ms | 876 KB | Output is correct |
66 | Correct | 5 ms | 876 KB | Output is correct |
67 | Correct | 11 ms | 876 KB | Output is correct |
68 | Correct | 28 ms | 876 KB | Output is correct |
69 | Correct | 60 ms | 876 KB | Output is correct |
70 | Correct | 62 ms | 876 KB | Output is correct |
71 | Correct | 5 ms | 876 KB | Output is correct |
72 | Correct | 58 ms | 876 KB | Output is correct |
73 | Correct | 45 ms | 876 KB | Output is correct |
74 | Correct | 39 ms | 876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 876 KB | Output is correct |
2 | Correct | 2 ms | 876 KB | Output is correct |
3 | Correct | 2 ms | 876 KB | Output is correct |
4 | Correct | 2 ms | 876 KB | Output is correct |
5 | Correct | 2 ms | 876 KB | Output is correct |
6 | Correct | 2 ms | 876 KB | Output is correct |
7 | Correct | 2 ms | 876 KB | Output is correct |
8 | Correct | 2 ms | 876 KB | Output is correct |
9 | Correct | 2 ms | 876 KB | Output is correct |
10 | Correct | 2 ms | 876 KB | Output is correct |
11 | Correct | 2 ms | 876 KB | Output is correct |
12 | Correct | 2 ms | 876 KB | Output is correct |
13 | Correct | 3 ms | 876 KB | Output is correct |
14 | Correct | 1 ms | 876 KB | Output is correct |
15 | Correct | 2 ms | 876 KB | Output is correct |
16 | Correct | 2 ms | 876 KB | Output is correct |
17 | Correct | 2 ms | 876 KB | Output is correct |
18 | Correct | 2 ms | 876 KB | Output is correct |
19 | Correct | 1 ms | 876 KB | Output is correct |
20 | Correct | 2 ms | 876 KB | Output is correct |
21 | Correct | 2 ms | 876 KB | Output is correct |
22 | Correct | 2 ms | 876 KB | Output is correct |
23 | Correct | 2 ms | 876 KB | Output is correct |
24 | Correct | 2 ms | 876 KB | Output is correct |
25 | Correct | 2 ms | 876 KB | Output is correct |
26 | Correct | 2 ms | 876 KB | Output is correct |
27 | Correct | 4 ms | 876 KB | Output is correct |
28 | Correct | 5 ms | 876 KB | Output is correct |
29 | Correct | 5 ms | 876 KB | Output is correct |
30 | Correct | 2 ms | 876 KB | Output is correct |
31 | Correct | 5 ms | 876 KB | Output is correct |
32 | Correct | 6 ms | 876 KB | Output is correct |
33 | Correct | 3 ms | 876 KB | Output is correct |
34 | Correct | 5 ms | 876 KB | Output is correct |
35 | Correct | 6 ms | 876 KB | Output is correct |
36 | Correct | 11 ms | 876 KB | Output is correct |
37 | Correct | 32 ms | 876 KB | Output is correct |
38 | Correct | 71 ms | 876 KB | Output is correct |
39 | Correct | 68 ms | 876 KB | Output is correct |
40 | Correct | 3 ms | 876 KB | Output is correct |
41 | Correct | 33 ms | 876 KB | Output is correct |
42 | Correct | 53 ms | 876 KB | Output is correct |
43 | Correct | 6 ms | 876 KB | Output is correct |
44 | Correct | 11 ms | 876 KB | Output is correct |
45 | Correct | 28 ms | 876 KB | Output is correct |
46 | Correct | 61 ms | 876 KB | Output is correct |
47 | Correct | 57 ms | 876 KB | Output is correct |
48 | Correct | 3 ms | 876 KB | Output is correct |
49 | Correct | 59 ms | 876 KB | Output is correct |
50 | Correct | 61 ms | 876 KB | Output is correct |
51 | Correct | 2 ms | 876 KB | Output is correct |
52 | Correct | 22 ms | 876 KB | Output is correct |
53 | Correct | 34 ms | 876 KB | Output is correct |
54 | Correct | 62 ms | 876 KB | Output is correct |
55 | Correct | 60 ms | 876 KB | Output is correct |
56 | Correct | 234 ms | 876 KB | Output is correct |
57 | Correct | 249 ms | 876 KB | Output is correct |
58 | Correct | 227 ms | 876 KB | Output is correct |
59 | Correct | 228 ms | 876 KB | Output is correct |
60 | Correct | 240 ms | 876 KB | Output is correct |
61 | Correct | 2 ms | 876 KB | Output is correct |
62 | Correct | 35 ms | 876 KB | Output is correct |
63 | Correct | 64 ms | 876 KB | Output is correct |
64 | Correct | 64 ms | 876 KB | Output is correct |
65 | Correct | 114 ms | 876 KB | Output is correct |
66 | Correct | 185 ms | 876 KB | Output is correct |
67 | Correct | 232 ms | 876 KB | Output is correct |
68 | Correct | 231 ms | 876 KB | Output is correct |
69 | Correct | 226 ms | 876 KB | Output is correct |