# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
24675 | 2017-06-11T06:40:09 Z | chan492811 | Bali Sculptures (APIO15_sculpture) | C++11 | 176 ms | 1184 KB |
#include <cstdio> #include <algorithm> #define ll long long using namespace std; int n,a,b; ll sum[2010],res; int table[2010],table2[110][110]; bool make(int flag){ int i,j,k; if(flag){ for(i=1;i<=n;i++){ for(j=0;j<i;j++){ if((sum[i]-sum[j]|res)==res) table[i]=min(table[i],table[j]+1); } } if(table[n]<=b) return 1; return 0; }else{ for(k=1;k<=b;k++){ for(i=1;i<=n;i++){ table2[k][i]=0; for(j=0;j<i;j++){ if((sum[i]-sum[j]|res)==res){ table2[k][i]= max(table2[k][i],table2[k-1][j] ? 1 : 0 ); } } } } for(i=a;i<=b;i++){ if(table2[i][n]) return 1; } return 0; } } int main(){ int j; ll i; ll now; scanf("%d %d %d",&n,&a,&b); for(i=1;i<=n;i++){ scanf("%lld",&sum[i]); sum[i]+=sum[i-1]; } res=1ll<<50; res--; for(i=49;i>=0;i--){ for(j=1;j<2010;j++) table[j]=21e8; table2[0][0]=1; now=(1ll<<i); res-=now; if(a==1){ if(!make(1)) res+=now; }else{ if(!make(0)) res+=now; } } printf("%lld",res); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1184 KB | Output is correct |
2 | Correct | 0 ms | 1184 KB | Output is correct |
3 | Correct | 0 ms | 1184 KB | Output is correct |
4 | Correct | 0 ms | 1184 KB | Output is correct |
5 | Correct | 0 ms | 1184 KB | Output is correct |
6 | Correct | 0 ms | 1184 KB | Output is correct |
7 | Correct | 0 ms | 1184 KB | Output is correct |
8 | Correct | 0 ms | 1184 KB | Output is correct |
9 | Correct | 0 ms | 1184 KB | Output is correct |
10 | Correct | 0 ms | 1184 KB | Output is correct |
11 | Correct | 0 ms | 1184 KB | Output is correct |
12 | Correct | 0 ms | 1184 KB | Output is correct |
13 | Correct | 0 ms | 1184 KB | Output is correct |
14 | Correct | 0 ms | 1184 KB | Output is correct |
15 | Correct | 0 ms | 1184 KB | Output is correct |
16 | Correct | 0 ms | 1184 KB | Output is correct |
17 | Correct | 0 ms | 1184 KB | Output is correct |
18 | Correct | 0 ms | 1184 KB | Output is correct |
19 | Correct | 0 ms | 1184 KB | Output is correct |
20 | Correct | 0 ms | 1184 KB | Output is correct |
21 | Correct | 0 ms | 1184 KB | Output is correct |
22 | Correct | 0 ms | 1184 KB | Output is correct |
23 | Correct | 0 ms | 1184 KB | Output is correct |
24 | Correct | 0 ms | 1184 KB | Output is correct |
25 | Correct | 0 ms | 1184 KB | Output is correct |
26 | Correct | 0 ms | 1184 KB | Output is correct |
27 | Correct | 0 ms | 1184 KB | Output is correct |
28 | Correct | 0 ms | 1184 KB | Output is correct |
29 | Correct | 0 ms | 1184 KB | Output is correct |
30 | Correct | 0 ms | 1184 KB | Output is correct |
31 | Correct | 0 ms | 1184 KB | Output is correct |
32 | Correct | 0 ms | 1184 KB | Output is correct |
33 | Correct | 0 ms | 1184 KB | Output is correct |
34 | Correct | 0 ms | 1184 KB | Output is correct |
35 | Correct | 0 ms | 1184 KB | Output is correct |
36 | Correct | 0 ms | 1184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1184 KB | Output is correct |
2 | Correct | 0 ms | 1184 KB | Output is correct |
3 | Correct | 0 ms | 1184 KB | Output is correct |
4 | Correct | 0 ms | 1184 KB | Output is correct |
5 | Correct | 0 ms | 1184 KB | Output is correct |
6 | Correct | 0 ms | 1184 KB | Output is correct |
7 | Correct | 0 ms | 1184 KB | Output is correct |
8 | Correct | 0 ms | 1184 KB | Output is correct |
9 | Correct | 0 ms | 1184 KB | Output is correct |
10 | Correct | 0 ms | 1184 KB | Output is correct |
11 | Correct | 0 ms | 1184 KB | Output is correct |
12 | Correct | 0 ms | 1184 KB | Output is correct |
13 | Correct | 0 ms | 1184 KB | Output is correct |
14 | Correct | 0 ms | 1184 KB | Output is correct |
15 | Correct | 0 ms | 1184 KB | Output is correct |
16 | Correct | 0 ms | 1184 KB | Output is correct |
17 | Correct | 0 ms | 1184 KB | Output is correct |
18 | Correct | 0 ms | 1184 KB | Output is correct |
19 | Correct | 0 ms | 1184 KB | Output is correct |
20 | Correct | 0 ms | 1184 KB | Output is correct |
21 | Correct | 0 ms | 1184 KB | Output is correct |
22 | Correct | 0 ms | 1184 KB | Output is correct |
23 | Correct | 0 ms | 1184 KB | Output is correct |
24 | Correct | 0 ms | 1184 KB | Output is correct |
25 | Correct | 0 ms | 1184 KB | Output is correct |
26 | Correct | 0 ms | 1184 KB | Output is correct |
27 | Correct | 0 ms | 1184 KB | Output is correct |
28 | Correct | 0 ms | 1184 KB | Output is correct |
29 | Correct | 0 ms | 1184 KB | Output is correct |
30 | Correct | 0 ms | 1184 KB | Output is correct |
31 | Correct | 0 ms | 1184 KB | Output is correct |
32 | Correct | 0 ms | 1184 KB | Output is correct |
33 | Correct | 0 ms | 1184 KB | Output is correct |
34 | Correct | 0 ms | 1184 KB | Output is correct |
35 | Correct | 0 ms | 1184 KB | Output is correct |
36 | Correct | 0 ms | 1184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1184 KB | Output is correct |
2 | Correct | 0 ms | 1184 KB | Output is correct |
3 | Correct | 0 ms | 1184 KB | Output is correct |
4 | Correct | 0 ms | 1184 KB | Output is correct |
5 | Correct | 0 ms | 1184 KB | Output is correct |
6 | Correct | 0 ms | 1184 KB | Output is correct |
7 | Correct | 0 ms | 1184 KB | Output is correct |
8 | Correct | 0 ms | 1184 KB | Output is correct |
9 | Correct | 0 ms | 1184 KB | Output is correct |
10 | Correct | 0 ms | 1184 KB | Output is correct |
11 | Correct | 0 ms | 1184 KB | Output is correct |
12 | Correct | 0 ms | 1184 KB | Output is correct |
13 | Correct | 0 ms | 1184 KB | Output is correct |
14 | Correct | 0 ms | 1184 KB | Output is correct |
15 | Correct | 0 ms | 1184 KB | Output is correct |
16 | Correct | 0 ms | 1184 KB | Output is correct |
17 | Correct | 0 ms | 1184 KB | Output is correct |
18 | Correct | 0 ms | 1184 KB | Output is correct |
19 | Correct | 0 ms | 1184 KB | Output is correct |
20 | Correct | 0 ms | 1184 KB | Output is correct |
21 | Correct | 0 ms | 1184 KB | Output is correct |
22 | Correct | 0 ms | 1184 KB | Output is correct |
23 | Correct | 0 ms | 1184 KB | Output is correct |
24 | Correct | 0 ms | 1184 KB | Output is correct |
25 | Correct | 0 ms | 1184 KB | Output is correct |
26 | Correct | 0 ms | 1184 KB | Output is correct |
27 | Correct | 0 ms | 1184 KB | Output is correct |
28 | Correct | 0 ms | 1184 KB | Output is correct |
29 | Correct | 0 ms | 1184 KB | Output is correct |
30 | Correct | 0 ms | 1184 KB | Output is correct |
31 | Correct | 0 ms | 1184 KB | Output is correct |
32 | Correct | 0 ms | 1184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1184 KB | Output is correct |
2 | Correct | 0 ms | 1184 KB | Output is correct |
3 | Correct | 0 ms | 1184 KB | Output is correct |
4 | Correct | 0 ms | 1184 KB | Output is correct |
5 | Correct | 0 ms | 1184 KB | Output is correct |
6 | Correct | 0 ms | 1184 KB | Output is correct |
7 | Correct | 0 ms | 1184 KB | Output is correct |
8 | Correct | 0 ms | 1184 KB | Output is correct |
9 | Correct | 0 ms | 1184 KB | Output is correct |
10 | Correct | 0 ms | 1184 KB | Output is correct |
11 | Correct | 0 ms | 1184 KB | Output is correct |
12 | Correct | 0 ms | 1184 KB | Output is correct |
13 | Correct | 0 ms | 1184 KB | Output is correct |
14 | Correct | 0 ms | 1184 KB | Output is correct |
15 | Correct | 0 ms | 1184 KB | Output is correct |
16 | Correct | 0 ms | 1184 KB | Output is correct |
17 | Correct | 0 ms | 1184 KB | Output is correct |
18 | Correct | 0 ms | 1184 KB | Output is correct |
19 | Correct | 0 ms | 1184 KB | Output is correct |
20 | Correct | 0 ms | 1184 KB | Output is correct |
21 | Correct | 0 ms | 1184 KB | Output is correct |
22 | Correct | 0 ms | 1184 KB | Output is correct |
23 | Correct | 0 ms | 1184 KB | Output is correct |
24 | Correct | 0 ms | 1184 KB | Output is correct |
25 | Correct | 0 ms | 1184 KB | Output is correct |
26 | Correct | 0 ms | 1184 KB | Output is correct |
27 | Correct | 0 ms | 1184 KB | Output is correct |
28 | Correct | 0 ms | 1184 KB | Output is correct |
29 | Correct | 0 ms | 1184 KB | Output is correct |
30 | Correct | 0 ms | 1184 KB | Output is correct |
31 | Correct | 0 ms | 1184 KB | Output is correct |
32 | Correct | 0 ms | 1184 KB | Output is correct |
33 | Correct | 0 ms | 1184 KB | Output is correct |
34 | Correct | 0 ms | 1184 KB | Output is correct |
35 | Correct | 0 ms | 1184 KB | Output is correct |
36 | Correct | 0 ms | 1184 KB | Output is correct |
37 | Correct | 0 ms | 1184 KB | Output is correct |
38 | Correct | 0 ms | 1184 KB | Output is correct |
39 | Correct | 0 ms | 1184 KB | Output is correct |
40 | Correct | 0 ms | 1184 KB | Output is correct |
41 | Correct | 0 ms | 1184 KB | Output is correct |
42 | Correct | 0 ms | 1184 KB | Output is correct |
43 | Correct | 0 ms | 1184 KB | Output is correct |
44 | Correct | 0 ms | 1184 KB | Output is correct |
45 | Correct | 0 ms | 1184 KB | Output is correct |
46 | Correct | 0 ms | 1184 KB | Output is correct |
47 | Correct | 0 ms | 1184 KB | Output is correct |
48 | Correct | 0 ms | 1184 KB | Output is correct |
49 | Correct | 0 ms | 1184 KB | Output is correct |
50 | Correct | 0 ms | 1184 KB | Output is correct |
51 | Correct | 0 ms | 1184 KB | Output is correct |
52 | Correct | 0 ms | 1184 KB | Output is correct |
53 | Correct | 0 ms | 1184 KB | Output is correct |
54 | Correct | 0 ms | 1184 KB | Output is correct |
55 | Correct | 0 ms | 1184 KB | Output is correct |
56 | Correct | 0 ms | 1184 KB | Output is correct |
57 | Correct | 0 ms | 1184 KB | Output is correct |
58 | Correct | 0 ms | 1184 KB | Output is correct |
59 | Correct | 0 ms | 1184 KB | Output is correct |
60 | Correct | 0 ms | 1184 KB | Output is correct |
61 | Correct | 0 ms | 1184 KB | Output is correct |
62 | Correct | 0 ms | 1184 KB | Output is correct |
63 | Correct | 0 ms | 1184 KB | Output is correct |
64 | Correct | 46 ms | 1184 KB | Output is correct |
65 | Correct | 0 ms | 1184 KB | Output is correct |
66 | Correct | 0 ms | 1184 KB | Output is correct |
67 | Correct | 3 ms | 1184 KB | Output is correct |
68 | Correct | 16 ms | 1184 KB | Output is correct |
69 | Correct | 39 ms | 1184 KB | Output is correct |
70 | Correct | 36 ms | 1184 KB | Output is correct |
71 | Correct | 0 ms | 1184 KB | Output is correct |
72 | Correct | 46 ms | 1184 KB | Output is correct |
73 | Correct | 46 ms | 1184 KB | Output is correct |
74 | Correct | 26 ms | 1184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1184 KB | Output is correct |
2 | Correct | 0 ms | 1184 KB | Output is correct |
3 | Correct | 0 ms | 1184 KB | Output is correct |
4 | Correct | 0 ms | 1184 KB | Output is correct |
5 | Correct | 0 ms | 1184 KB | Output is correct |
6 | Correct | 0 ms | 1184 KB | Output is correct |
7 | Correct | 0 ms | 1184 KB | Output is correct |
8 | Correct | 0 ms | 1184 KB | Output is correct |
9 | Correct | 0 ms | 1184 KB | Output is correct |
10 | Correct | 0 ms | 1184 KB | Output is correct |
11 | Correct | 0 ms | 1184 KB | Output is correct |
12 | Correct | 0 ms | 1184 KB | Output is correct |
13 | Correct | 0 ms | 1184 KB | Output is correct |
14 | Correct | 0 ms | 1184 KB | Output is correct |
15 | Correct | 0 ms | 1184 KB | Output is correct |
16 | Correct | 0 ms | 1184 KB | Output is correct |
17 | Correct | 0 ms | 1184 KB | Output is correct |
18 | Correct | 0 ms | 1184 KB | Output is correct |
19 | Correct | 0 ms | 1184 KB | Output is correct |
20 | Correct | 0 ms | 1184 KB | Output is correct |
21 | Correct | 0 ms | 1184 KB | Output is correct |
22 | Correct | 0 ms | 1184 KB | Output is correct |
23 | Correct | 0 ms | 1184 KB | Output is correct |
24 | Correct | 0 ms | 1184 KB | Output is correct |
25 | Correct | 0 ms | 1184 KB | Output is correct |
26 | Correct | 0 ms | 1184 KB | Output is correct |
27 | Correct | 0 ms | 1184 KB | Output is correct |
28 | Correct | 0 ms | 1184 KB | Output is correct |
29 | Correct | 0 ms | 1184 KB | Output is correct |
30 | Correct | 0 ms | 1184 KB | Output is correct |
31 | Correct | 0 ms | 1184 KB | Output is correct |
32 | Correct | 0 ms | 1184 KB | Output is correct |
33 | Correct | 0 ms | 1184 KB | Output is correct |
34 | Correct | 0 ms | 1184 KB | Output is correct |
35 | Correct | 0 ms | 1184 KB | Output is correct |
36 | Correct | 0 ms | 1184 KB | Output is correct |
37 | Correct | 0 ms | 1184 KB | Output is correct |
38 | Correct | 0 ms | 1184 KB | Output is correct |
39 | Correct | 0 ms | 1184 KB | Output is correct |
40 | Correct | 0 ms | 1184 KB | Output is correct |
41 | Correct | 0 ms | 1184 KB | Output is correct |
42 | Correct | 0 ms | 1184 KB | Output is correct |
43 | Correct | 0 ms | 1184 KB | Output is correct |
44 | Correct | 0 ms | 1184 KB | Output is correct |
45 | Correct | 0 ms | 1184 KB | Output is correct |
46 | Correct | 0 ms | 1184 KB | Output is correct |
47 | Correct | 0 ms | 1184 KB | Output is correct |
48 | Correct | 0 ms | 1184 KB | Output is correct |
49 | Correct | 0 ms | 1184 KB | Output is correct |
50 | Correct | 0 ms | 1184 KB | Output is correct |
51 | Correct | 0 ms | 1184 KB | Output is correct |
52 | Correct | 16 ms | 1184 KB | Output is correct |
53 | Correct | 23 ms | 1184 KB | Output is correct |
54 | Correct | 49 ms | 1184 KB | Output is correct |
55 | Correct | 39 ms | 1184 KB | Output is correct |
56 | Correct | 166 ms | 1184 KB | Output is correct |
57 | Correct | 153 ms | 1184 KB | Output is correct |
58 | Correct | 156 ms | 1184 KB | Output is correct |
59 | Correct | 176 ms | 1184 KB | Output is correct |
60 | Correct | 146 ms | 1184 KB | Output is correct |
61 | Correct | 0 ms | 1184 KB | Output is correct |
62 | Correct | 19 ms | 1184 KB | Output is correct |
63 | Correct | 39 ms | 1184 KB | Output is correct |
64 | Correct | 39 ms | 1184 KB | Output is correct |
65 | Correct | 69 ms | 1184 KB | Output is correct |
66 | Correct | 116 ms | 1184 KB | Output is correct |
67 | Correct | 166 ms | 1184 KB | Output is correct |
68 | Correct | 153 ms | 1184 KB | Output is correct |
69 | Correct | 143 ms | 1184 KB | Output is correct |