# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72710 | 2018-08-26T18:48:10 Z | Pajaraja | Bali Sculptures (APIO15_sculpture) | C++17 | 628 ms | 31720 KB |
#include <bits/stdc++.h> #define MAXN 2007 using namespace std; long long s[MAXN][MAXN],arr[MAXN]; bool g[MAXN][MAXN],ag[MAXN][MAXN],dp[MAXN][MAXN]; int dpl[MAXN]; int main() { int n,a,b; scanf("%d%d%d",&n,&a,&b); for(int i=0;i<n;i++) scanf("%lld",&arr[i]); for(int i=0;i<n;i++) s[i][i]=arr[i]; for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) {ag[i][j]=true; s[i][j]=s[i][j-1]+arr[j];} long long rez=0; for(int x=40;x>=0;x--) { for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) g[i][j]=(((1LL<<x)|s[i][j-1])!=s[i][j-1]) && ag[i][j]; bool ra=false; if(n<=200) { for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) dp[i][j]=false; dp[0][0]=true; for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) if(g[i][j]) for(int r=1;r<=n;r++) dp[j][r]=dp[j][r]||dp[i][r-1]; for(int i=a;i<=b;i++) if(dp[n][i]) ra=true; } else { for(int i=1;i<=n;i++) dpl[i]=MAXN; dpl[0]=0; for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) if(g[i][j]) dpl[j]=min(dpl[j],dpl[i]+1); if(dpl[n]<=b) ra=true; } if(ra) for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) ag[i][j]=g[i][j]; else rez+=(1LL<<x); } printf("%lld",rez); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 684 KB | Output is correct |
3 | Correct | 3 ms | 684 KB | Output is correct |
4 | Correct | 2 ms | 684 KB | Output is correct |
5 | Correct | 2 ms | 684 KB | Output is correct |
6 | Correct | 3 ms | 684 KB | Output is correct |
7 | Correct | 3 ms | 700 KB | Output is correct |
8 | Correct | 4 ms | 700 KB | Output is correct |
9 | Correct | 4 ms | 700 KB | Output is correct |
10 | Correct | 4 ms | 792 KB | Output is correct |
11 | Correct | 4 ms | 792 KB | Output is correct |
12 | Correct | 2 ms | 792 KB | Output is correct |
13 | Correct | 3 ms | 792 KB | Output is correct |
14 | Correct | 3 ms | 792 KB | Output is correct |
15 | Correct | 3 ms | 792 KB | Output is correct |
16 | Correct | 3 ms | 792 KB | Output is correct |
17 | Correct | 3 ms | 792 KB | Output is correct |
18 | Correct | 2 ms | 792 KB | Output is correct |
19 | Correct | 3 ms | 792 KB | Output is correct |
20 | Correct | 3 ms | 792 KB | Output is correct |
21 | Correct | 3 ms | 792 KB | Output is correct |
22 | Correct | 3 ms | 792 KB | Output is correct |
23 | Correct | 4 ms | 792 KB | Output is correct |
24 | Correct | 4 ms | 792 KB | Output is correct |
25 | Correct | 4 ms | 792 KB | Output is correct |
26 | Correct | 3 ms | 792 KB | Output is correct |
27 | Correct | 2 ms | 792 KB | Output is correct |
28 | Correct | 2 ms | 792 KB | Output is correct |
29 | Correct | 3 ms | 792 KB | Output is correct |
30 | Correct | 4 ms | 792 KB | Output is correct |
31 | Correct | 3 ms | 792 KB | Output is correct |
32 | Correct | 4 ms | 792 KB | Output is correct |
33 | Correct | 3 ms | 792 KB | Output is correct |
34 | Correct | 3 ms | 792 KB | Output is correct |
35 | Correct | 3 ms | 792 KB | Output is correct |
36 | Correct | 4 ms | 792 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 792 KB | Output is correct |
2 | Correct | 3 ms | 792 KB | Output is correct |
3 | Correct | 3 ms | 792 KB | Output is correct |
4 | Correct | 3 ms | 792 KB | Output is correct |
5 | Correct | 3 ms | 792 KB | Output is correct |
6 | Correct | 2 ms | 792 KB | Output is correct |
7 | Correct | 3 ms | 792 KB | Output is correct |
8 | Correct | 4 ms | 792 KB | Output is correct |
9 | Correct | 3 ms | 792 KB | Output is correct |
10 | Correct | 3 ms | 792 KB | Output is correct |
11 | Correct | 3 ms | 792 KB | Output is correct |
12 | Correct | 3 ms | 792 KB | Output is correct |
13 | Correct | 4 ms | 792 KB | Output is correct |
14 | Correct | 2 ms | 792 KB | Output is correct |
15 | Correct | 2 ms | 792 KB | Output is correct |
16 | Correct | 3 ms | 792 KB | Output is correct |
17 | Correct | 2 ms | 792 KB | Output is correct |
18 | Correct | 3 ms | 792 KB | Output is correct |
19 | Correct | 2 ms | 792 KB | Output is correct |
20 | Correct | 3 ms | 792 KB | Output is correct |
21 | Correct | 4 ms | 832 KB | Output is correct |
22 | Correct | 3 ms | 832 KB | Output is correct |
23 | Correct | 3 ms | 832 KB | Output is correct |
24 | Correct | 4 ms | 832 KB | Output is correct |
25 | Correct | 3 ms | 832 KB | Output is correct |
26 | Correct | 4 ms | 832 KB | Output is correct |
27 | Correct | 3 ms | 832 KB | Output is correct |
28 | Correct | 3 ms | 892 KB | Output is correct |
29 | Correct | 6 ms | 1020 KB | Output is correct |
30 | Correct | 6 ms | 1020 KB | Output is correct |
31 | Correct | 7 ms | 1148 KB | Output is correct |
32 | Correct | 7 ms | 1256 KB | Output is correct |
33 | Correct | 9 ms | 1256 KB | Output is correct |
34 | Correct | 7 ms | 1256 KB | Output is correct |
35 | Correct | 8 ms | 1256 KB | Output is correct |
36 | Correct | 7 ms | 1256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1256 KB | Output is correct |
2 | Correct | 3 ms | 1256 KB | Output is correct |
3 | Correct | 2 ms | 1256 KB | Output is correct |
4 | Correct | 3 ms | 1256 KB | Output is correct |
5 | Correct | 3 ms | 1256 KB | Output is correct |
6 | Correct | 4 ms | 1256 KB | Output is correct |
7 | Correct | 4 ms | 1256 KB | Output is correct |
8 | Correct | 3 ms | 1256 KB | Output is correct |
9 | Correct | 4 ms | 1256 KB | Output is correct |
10 | Correct | 3 ms | 1256 KB | Output is correct |
11 | Correct | 3 ms | 1256 KB | Output is correct |
12 | Correct | 3 ms | 1256 KB | Output is correct |
13 | Correct | 3 ms | 1256 KB | Output is correct |
14 | Correct | 3 ms | 1256 KB | Output is correct |
15 | Correct | 4 ms | 1256 KB | Output is correct |
16 | Correct | 6 ms | 1256 KB | Output is correct |
17 | Correct | 6 ms | 1256 KB | Output is correct |
18 | Correct | 6 ms | 1256 KB | Output is correct |
19 | Correct | 7 ms | 1256 KB | Output is correct |
20 | Correct | 8 ms | 1276 KB | Output is correct |
21 | Correct | 7 ms | 1276 KB | Output is correct |
22 | Correct | 6 ms | 1276 KB | Output is correct |
23 | Correct | 8 ms | 1276 KB | Output is correct |
24 | Correct | 9 ms | 1276 KB | Output is correct |
25 | Correct | 10 ms | 1276 KB | Output is correct |
26 | Correct | 16 ms | 1404 KB | Output is correct |
27 | Correct | 23 ms | 1608 KB | Output is correct |
28 | Correct | 27 ms | 1664 KB | Output is correct |
29 | Correct | 30 ms | 1788 KB | Output is correct |
30 | Correct | 30 ms | 1788 KB | Output is correct |
31 | Correct | 29 ms | 1788 KB | Output is correct |
32 | Correct | 28 ms | 1788 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1788 KB | Output is correct |
2 | Correct | 4 ms | 1788 KB | Output is correct |
3 | Correct | 2 ms | 1788 KB | Output is correct |
4 | Correct | 3 ms | 1788 KB | Output is correct |
5 | Correct | 2 ms | 1788 KB | Output is correct |
6 | Correct | 2 ms | 1788 KB | Output is correct |
7 | Correct | 1 ms | 1788 KB | Output is correct |
8 | Correct | 3 ms | 1788 KB | Output is correct |
9 | Correct | 2 ms | 1788 KB | Output is correct |
10 | Correct | 4 ms | 1788 KB | Output is correct |
11 | Correct | 4 ms | 1788 KB | Output is correct |
12 | Correct | 3 ms | 1788 KB | Output is correct |
13 | Correct | 3 ms | 1788 KB | Output is correct |
14 | Correct | 2 ms | 1788 KB | Output is correct |
15 | Correct | 3 ms | 1788 KB | Output is correct |
16 | Correct | 3 ms | 1788 KB | Output is correct |
17 | Correct | 3 ms | 1788 KB | Output is correct |
18 | Correct | 3 ms | 1788 KB | Output is correct |
19 | Correct | 3 ms | 1788 KB | Output is correct |
20 | Correct | 3 ms | 1788 KB | Output is correct |
21 | Correct | 3 ms | 1788 KB | Output is correct |
22 | Correct | 4 ms | 1788 KB | Output is correct |
23 | Correct | 3 ms | 1788 KB | Output is correct |
24 | Correct | 3 ms | 1788 KB | Output is correct |
25 | Correct | 3 ms | 1788 KB | Output is correct |
26 | Correct | 3 ms | 1788 KB | Output is correct |
27 | Correct | 3 ms | 1788 KB | Output is correct |
28 | Correct | 3 ms | 1788 KB | Output is correct |
29 | Correct | 3 ms | 1788 KB | Output is correct |
30 | Correct | 3 ms | 1788 KB | Output is correct |
31 | Correct | 4 ms | 1788 KB | Output is correct |
32 | Correct | 3 ms | 1788 KB | Output is correct |
33 | Correct | 3 ms | 1788 KB | Output is correct |
34 | Correct | 3 ms | 1788 KB | Output is correct |
35 | Correct | 4 ms | 1788 KB | Output is correct |
36 | Correct | 4 ms | 1788 KB | Output is correct |
37 | Correct | 3 ms | 1788 KB | Output is correct |
38 | Correct | 4 ms | 1788 KB | Output is correct |
39 | Correct | 6 ms | 1788 KB | Output is correct |
40 | Correct | 7 ms | 1788 KB | Output is correct |
41 | Correct | 9 ms | 1788 KB | Output is correct |
42 | Correct | 8 ms | 1788 KB | Output is correct |
43 | Correct | 7 ms | 1788 KB | Output is correct |
44 | Correct | 8 ms | 1788 KB | Output is correct |
45 | Correct | 7 ms | 1788 KB | Output is correct |
46 | Correct | 7 ms | 1788 KB | Output is correct |
47 | Correct | 7 ms | 1788 KB | Output is correct |
48 | Correct | 11 ms | 1788 KB | Output is correct |
49 | Correct | 19 ms | 1788 KB | Output is correct |
50 | Correct | 22 ms | 1788 KB | Output is correct |
51 | Correct | 27 ms | 1788 KB | Output is correct |
52 | Correct | 35 ms | 1788 KB | Output is correct |
53 | Correct | 29 ms | 1788 KB | Output is correct |
54 | Correct | 27 ms | 1788 KB | Output is correct |
55 | Correct | 28 ms | 1788 KB | Output is correct |
56 | Correct | 4 ms | 1788 KB | Output is correct |
57 | Correct | 7 ms | 1788 KB | Output is correct |
58 | Correct | 10 ms | 1788 KB | Output is correct |
59 | Correct | 10 ms | 1788 KB | Output is correct |
60 | Correct | 11 ms | 1788 KB | Output is correct |
61 | Correct | 10 ms | 1788 KB | Output is correct |
62 | Correct | 14 ms | 1788 KB | Output is correct |
63 | Correct | 13 ms | 1788 KB | Output is correct |
64 | Correct | 25 ms | 1788 KB | Output is correct |
65 | Correct | 6 ms | 1788 KB | Output is correct |
66 | Correct | 6 ms | 1788 KB | Output is correct |
67 | Correct | 7 ms | 1788 KB | Output is correct |
68 | Correct | 10 ms | 1788 KB | Output is correct |
69 | Correct | 14 ms | 1788 KB | Output is correct |
70 | Correct | 12 ms | 1788 KB | Output is correct |
71 | Correct | 11 ms | 1788 KB | Output is correct |
72 | Correct | 13 ms | 1788 KB | Output is correct |
73 | Correct | 14 ms | 1788 KB | Output is correct |
74 | Correct | 12 ms | 1788 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1788 KB | Output is correct |
2 | Correct | 3 ms | 1788 KB | Output is correct |
3 | Correct | 2 ms | 1788 KB | Output is correct |
4 | Correct | 4 ms | 1788 KB | Output is correct |
5 | Correct | 3 ms | 1788 KB | Output is correct |
6 | Correct | 4 ms | 1788 KB | Output is correct |
7 | Correct | 3 ms | 1788 KB | Output is correct |
8 | Correct | 3 ms | 1788 KB | Output is correct |
9 | Correct | 3 ms | 1788 KB | Output is correct |
10 | Correct | 3 ms | 1788 KB | Output is correct |
11 | Correct | 3 ms | 1788 KB | Output is correct |
12 | Correct | 3 ms | 1788 KB | Output is correct |
13 | Correct | 3 ms | 1788 KB | Output is correct |
14 | Correct | 3 ms | 1788 KB | Output is correct |
15 | Correct | 3 ms | 1788 KB | Output is correct |
16 | Correct | 1 ms | 1788 KB | Output is correct |
17 | Correct | 3 ms | 1788 KB | Output is correct |
18 | Correct | 3 ms | 1788 KB | Output is correct |
19 | Correct | 4 ms | 1788 KB | Output is correct |
20 | Correct | 3 ms | 1788 KB | Output is correct |
21 | Correct | 3 ms | 1788 KB | Output is correct |
22 | Correct | 3 ms | 1788 KB | Output is correct |
23 | Correct | 4 ms | 1788 KB | Output is correct |
24 | Correct | 3 ms | 1788 KB | Output is correct |
25 | Correct | 4 ms | 1788 KB | Output is correct |
26 | Correct | 5 ms | 1788 KB | Output is correct |
27 | Correct | 6 ms | 1788 KB | Output is correct |
28 | Correct | 7 ms | 1788 KB | Output is correct |
29 | Correct | 7 ms | 1788 KB | Output is correct |
30 | Correct | 7 ms | 1788 KB | Output is correct |
31 | Correct | 7 ms | 1788 KB | Output is correct |
32 | Correct | 7 ms | 1788 KB | Output is correct |
33 | Correct | 7 ms | 1788 KB | Output is correct |
34 | Correct | 8 ms | 1788 KB | Output is correct |
35 | Correct | 11 ms | 1788 KB | Output is correct |
36 | Correct | 16 ms | 1788 KB | Output is correct |
37 | Correct | 23 ms | 1788 KB | Output is correct |
38 | Correct | 27 ms | 1788 KB | Output is correct |
39 | Correct | 24 ms | 1788 KB | Output is correct |
40 | Correct | 29 ms | 1788 KB | Output is correct |
41 | Correct | 29 ms | 1788 KB | Output is correct |
42 | Correct | 31 ms | 1788 KB | Output is correct |
43 | Correct | 5 ms | 1788 KB | Output is correct |
44 | Correct | 8 ms | 1788 KB | Output is correct |
45 | Correct | 10 ms | 1788 KB | Output is correct |
46 | Correct | 10 ms | 1788 KB | Output is correct |
47 | Correct | 8 ms | 1788 KB | Output is correct |
48 | Correct | 12 ms | 1788 KB | Output is correct |
49 | Correct | 12 ms | 1788 KB | Output is correct |
50 | Correct | 12 ms | 1788 KB | Output is correct |
51 | Correct | 10 ms | 1788 KB | Output is correct |
52 | Correct | 53 ms | 6524 KB | Output is correct |
53 | Correct | 88 ms | 8812 KB | Output is correct |
54 | Correct | 154 ms | 12592 KB | Output is correct |
55 | Correct | 153 ms | 12620 KB | Output is correct |
56 | Correct | 628 ms | 31328 KB | Output is correct |
57 | Correct | 596 ms | 31472 KB | Output is correct |
58 | Correct | 488 ms | 31472 KB | Output is correct |
59 | Correct | 323 ms | 31528 KB | Output is correct |
60 | Correct | 345 ms | 31528 KB | Output is correct |
61 | Correct | 12 ms | 31528 KB | Output is correct |
62 | Correct | 73 ms | 31528 KB | Output is correct |
63 | Correct | 129 ms | 31528 KB | Output is correct |
64 | Correct | 132 ms | 31528 KB | Output is correct |
65 | Correct | 246 ms | 31528 KB | Output is correct |
66 | Correct | 334 ms | 31528 KB | Output is correct |
67 | Correct | 476 ms | 31552 KB | Output is correct |
68 | Correct | 494 ms | 31572 KB | Output is correct |
69 | Correct | 430 ms | 31720 KB | Output is correct |