# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72709 | 2018-08-26T18:45:16 Z | Pajaraja | Bali Sculptures (APIO15_sculpture) | C++17 | 49 ms | 7672 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++) 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 592 KB | Output is correct |
6 | Correct | 3 ms | 648 KB | Output is correct |
7 | Correct | 2 ms | 652 KB | Output is correct |
8 | Correct | 3 ms | 824 KB | Output is correct |
9 | Correct | 2 ms | 864 KB | Output is correct |
10 | Correct | 3 ms | 864 KB | Output is correct |
11 | Correct | 3 ms | 864 KB | Output is correct |
12 | Correct | 3 ms | 864 KB | Output is correct |
13 | Correct | 3 ms | 864 KB | Output is correct |
14 | Correct | 2 ms | 864 KB | Output is correct |
15 | Correct | 2 ms | 864 KB | Output is correct |
16 | Correct | 2 ms | 864 KB | Output is correct |
17 | Correct | 2 ms | 864 KB | Output is correct |
18 | Correct | 2 ms | 864 KB | Output is correct |
19 | Correct | 3 ms | 908 KB | Output is correct |
20 | Correct | 3 ms | 1036 KB | Output is correct |
21 | Correct | 3 ms | 1036 KB | Output is correct |
22 | Correct | 4 ms | 1036 KB | Output is correct |
23 | Correct | 3 ms | 1036 KB | Output is correct |
24 | Correct | 3 ms | 1036 KB | Output is correct |
25 | Correct | 2 ms | 1036 KB | Output is correct |
26 | Correct | 3 ms | 1036 KB | Output is correct |
27 | Correct | 2 ms | 1036 KB | Output is correct |
28 | Correct | 3 ms | 1036 KB | Output is correct |
29 | Correct | 3 ms | 1036 KB | Output is correct |
30 | Correct | 3 ms | 1092 KB | Output is correct |
31 | Correct | 3 ms | 1092 KB | Output is correct |
32 | Correct | 2 ms | 1092 KB | Output is correct |
33 | Correct | 2 ms | 1092 KB | Output is correct |
34 | Correct | 3 ms | 1092 KB | Output is correct |
35 | Correct | 2 ms | 1092 KB | Output is correct |
36 | Correct | 3 ms | 1092 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1092 KB | Output is correct |
2 | Correct | 3 ms | 1092 KB | Output is correct |
3 | Correct | 2 ms | 1092 KB | Output is correct |
4 | Correct | 2 ms | 1092 KB | Output is correct |
5 | Correct | 2 ms | 1092 KB | Output is correct |
6 | Correct | 2 ms | 1092 KB | Output is correct |
7 | Correct | 3 ms | 1092 KB | Output is correct |
8 | Correct | 3 ms | 1092 KB | Output is correct |
9 | Correct | 3 ms | 1092 KB | Output is correct |
10 | Correct | 3 ms | 1092 KB | Output is correct |
11 | Correct | 3 ms | 1092 KB | Output is correct |
12 | Correct | 4 ms | 1092 KB | Output is correct |
13 | Correct | 3 ms | 1092 KB | Output is correct |
14 | Correct | 3 ms | 1092 KB | Output is correct |
15 | Correct | 2 ms | 1092 KB | Output is correct |
16 | Correct | 2 ms | 1092 KB | Output is correct |
17 | Correct | 2 ms | 1092 KB | Output is correct |
18 | Correct | 3 ms | 1092 KB | Output is correct |
19 | Correct | 2 ms | 1092 KB | Output is correct |
20 | Correct | 3 ms | 1092 KB | Output is correct |
21 | Correct | 3 ms | 1092 KB | Output is correct |
22 | Correct | 3 ms | 1092 KB | Output is correct |
23 | Correct | 2 ms | 1092 KB | Output is correct |
24 | Correct | 2 ms | 1092 KB | Output is correct |
25 | Correct | 3 ms | 1092 KB | Output is correct |
26 | Correct | 4 ms | 1092 KB | Output is correct |
27 | Correct | 2 ms | 1092 KB | Output is correct |
28 | Correct | 3 ms | 1240 KB | Output is correct |
29 | Correct | 4 ms | 1372 KB | Output is correct |
30 | Correct | 5 ms | 1372 KB | Output is correct |
31 | Correct | 7 ms | 1492 KB | Output is correct |
32 | Correct | 6 ms | 1496 KB | Output is correct |
33 | Correct | 7 ms | 1500 KB | Output is correct |
34 | Correct | 6 ms | 1504 KB | Output is correct |
35 | Correct | 6 ms | 1508 KB | Output is correct |
36 | Correct | 9 ms | 1516 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1516 KB | Output is correct |
2 | Correct | 2 ms | 1516 KB | Output is correct |
3 | Correct | 2 ms | 1516 KB | Output is correct |
4 | Correct | 2 ms | 1516 KB | Output is correct |
5 | Correct | 3 ms | 1516 KB | Output is correct |
6 | Correct | 3 ms | 1516 KB | Output is correct |
7 | Correct | 3 ms | 1516 KB | Output is correct |
8 | Correct | 3 ms | 1516 KB | Output is correct |
9 | Correct | 3 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
11 | Correct | 3 ms | 1516 KB | Output is correct |
12 | Correct | 2 ms | 1516 KB | Output is correct |
13 | Correct | 4 ms | 1516 KB | Output is correct |
14 | Correct | 3 ms | 1516 KB | Output is correct |
15 | Correct | 3 ms | 1516 KB | Output is correct |
16 | Correct | 6 ms | 1516 KB | Output is correct |
17 | Correct | 5 ms | 1516 KB | Output is correct |
18 | Correct | 6 ms | 1608 KB | Output is correct |
19 | Correct | 7 ms | 1608 KB | Output is correct |
20 | Correct | 7 ms | 1612 KB | Output is correct |
21 | Correct | 6 ms | 1616 KB | Output is correct |
22 | Correct | 8 ms | 1620 KB | Output is correct |
23 | Correct | 6 ms | 1624 KB | Output is correct |
24 | Correct | 7 ms | 1628 KB | Output is correct |
25 | Correct | 9 ms | 1764 KB | Output is correct |
26 | Correct | 13 ms | 1928 KB | Output is correct |
27 | Correct | 17 ms | 2120 KB | Output is correct |
28 | Correct | 24 ms | 2192 KB | Output is correct |
29 | Correct | 33 ms | 2196 KB | Output is correct |
30 | Correct | 23 ms | 2204 KB | Output is correct |
31 | Correct | 25 ms | 2204 KB | Output is correct |
32 | Correct | 21 ms | 2208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2208 KB | Output is correct |
2 | Correct | 2 ms | 2208 KB | Output is correct |
3 | Correct | 3 ms | 2208 KB | Output is correct |
4 | Correct | 3 ms | 2208 KB | Output is correct |
5 | Correct | 3 ms | 2208 KB | Output is correct |
6 | Correct | 4 ms | 2208 KB | Output is correct |
7 | Correct | 3 ms | 2208 KB | Output is correct |
8 | Correct | 3 ms | 2208 KB | Output is correct |
9 | Correct | 4 ms | 2208 KB | Output is correct |
10 | Correct | 3 ms | 2208 KB | Output is correct |
11 | Correct | 3 ms | 2208 KB | Output is correct |
12 | Correct | 3 ms | 2208 KB | Output is correct |
13 | Correct | 3 ms | 2208 KB | Output is correct |
14 | Correct | 3 ms | 2208 KB | Output is correct |
15 | Correct | 2 ms | 2208 KB | Output is correct |
16 | Correct | 3 ms | 2208 KB | Output is correct |
17 | Correct | 2 ms | 2208 KB | Output is correct |
18 | Correct | 2 ms | 2208 KB | Output is correct |
19 | Correct | 3 ms | 2208 KB | Output is correct |
20 | Correct | 3 ms | 2208 KB | Output is correct |
21 | Correct | 2 ms | 2208 KB | Output is correct |
22 | Correct | 4 ms | 2208 KB | Output is correct |
23 | Correct | 2 ms | 2208 KB | Output is correct |
24 | Correct | 3 ms | 2208 KB | Output is correct |
25 | Correct | 5 ms | 2208 KB | Output is correct |
26 | Correct | 3 ms | 2208 KB | Output is correct |
27 | Correct | 3 ms | 2208 KB | Output is correct |
28 | Correct | 2 ms | 2208 KB | Output is correct |
29 | Correct | 3 ms | 2208 KB | Output is correct |
30 | Correct | 3 ms | 2208 KB | Output is correct |
31 | Correct | 3 ms | 2208 KB | Output is correct |
32 | Correct | 3 ms | 2208 KB | Output is correct |
33 | Correct | 3 ms | 2208 KB | Output is correct |
34 | Correct | 3 ms | 2208 KB | Output is correct |
35 | Correct | 4 ms | 2208 KB | Output is correct |
36 | Correct | 3 ms | 2208 KB | Output is correct |
37 | Correct | 3 ms | 2208 KB | Output is correct |
38 | Correct | 3 ms | 2208 KB | Output is correct |
39 | Correct | 5 ms | 2208 KB | Output is correct |
40 | Correct | 5 ms | 2208 KB | Output is correct |
41 | Correct | 6 ms | 2208 KB | Output is correct |
42 | Correct | 6 ms | 2208 KB | Output is correct |
43 | Correct | 7 ms | 2208 KB | Output is correct |
44 | Correct | 6 ms | 2208 KB | Output is correct |
45 | Correct | 6 ms | 2208 KB | Output is correct |
46 | Correct | 7 ms | 2208 KB | Output is correct |
47 | Correct | 8 ms | 2208 KB | Output is correct |
48 | Correct | 10 ms | 2208 KB | Output is correct |
49 | Correct | 15 ms | 2224 KB | Output is correct |
50 | Correct | 20 ms | 2356 KB | Output is correct |
51 | Correct | 24 ms | 2488 KB | Output is correct |
52 | Correct | 28 ms | 2488 KB | Output is correct |
53 | Correct | 28 ms | 2488 KB | Output is correct |
54 | Correct | 29 ms | 2488 KB | Output is correct |
55 | Correct | 23 ms | 2488 KB | Output is correct |
56 | Correct | 5 ms | 2488 KB | Output is correct |
57 | Correct | 7 ms | 2488 KB | Output is correct |
58 | Correct | 8 ms | 2488 KB | Output is correct |
59 | Correct | 9 ms | 2600 KB | Output is correct |
60 | Correct | 8 ms | 2600 KB | Output is correct |
61 | Correct | 11 ms | 2600 KB | Output is correct |
62 | Correct | 11 ms | 2600 KB | Output is correct |
63 | Correct | 12 ms | 2600 KB | Output is correct |
64 | Correct | 25 ms | 2600 KB | Output is correct |
65 | Correct | 4 ms | 2600 KB | Output is correct |
66 | Correct | 6 ms | 2600 KB | Output is correct |
67 | Correct | 7 ms | 2600 KB | Output is correct |
68 | Correct | 9 ms | 2600 KB | Output is correct |
69 | Correct | 10 ms | 2600 KB | Output is correct |
70 | Correct | 9 ms | 2600 KB | Output is correct |
71 | Correct | 8 ms | 2600 KB | Output is correct |
72 | Correct | 10 ms | 2600 KB | Output is correct |
73 | Correct | 11 ms | 2628 KB | Output is correct |
74 | Correct | 11 ms | 2628 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2628 KB | Output is correct |
2 | Correct | 2 ms | 2628 KB | Output is correct |
3 | Correct | 2 ms | 2628 KB | Output is correct |
4 | Correct | 2 ms | 2628 KB | Output is correct |
5 | Correct | 2 ms | 2628 KB | Output is correct |
6 | Correct | 2 ms | 2628 KB | Output is correct |
7 | Correct | 2 ms | 2628 KB | Output is correct |
8 | Correct | 2 ms | 2628 KB | Output is correct |
9 | Correct | 4 ms | 2628 KB | Output is correct |
10 | Correct | 3 ms | 2628 KB | Output is correct |
11 | Correct | 2 ms | 2628 KB | Output is correct |
12 | Correct | 3 ms | 2628 KB | Output is correct |
13 | Correct | 3 ms | 2628 KB | Output is correct |
14 | Correct | 2 ms | 2628 KB | Output is correct |
15 | Correct | 3 ms | 2628 KB | Output is correct |
16 | Correct | 2 ms | 2628 KB | Output is correct |
17 | Correct | 3 ms | 2628 KB | Output is correct |
18 | Correct | 2 ms | 2628 KB | Output is correct |
19 | Correct | 3 ms | 2628 KB | Output is correct |
20 | Correct | 4 ms | 2628 KB | Output is correct |
21 | Correct | 3 ms | 2628 KB | Output is correct |
22 | Correct | 3 ms | 2628 KB | Output is correct |
23 | Correct | 3 ms | 2628 KB | Output is correct |
24 | Correct | 5 ms | 2628 KB | Output is correct |
25 | Correct | 3 ms | 2628 KB | Output is correct |
26 | Correct | 4 ms | 2628 KB | Output is correct |
27 | Correct | 5 ms | 2628 KB | Output is correct |
28 | Correct | 6 ms | 2628 KB | Output is correct |
29 | Correct | 6 ms | 2628 KB | Output is correct |
30 | Correct | 7 ms | 2628 KB | Output is correct |
31 | Correct | 6 ms | 2628 KB | Output is correct |
32 | Correct | 6 ms | 2628 KB | Output is correct |
33 | Correct | 7 ms | 2628 KB | Output is correct |
34 | Correct | 6 ms | 2628 KB | Output is correct |
35 | Correct | 9 ms | 2628 KB | Output is correct |
36 | Correct | 13 ms | 2628 KB | Output is correct |
37 | Correct | 18 ms | 2628 KB | Output is correct |
38 | Correct | 22 ms | 2712 KB | Output is correct |
39 | Correct | 27 ms | 2716 KB | Output is correct |
40 | Correct | 23 ms | 2724 KB | Output is correct |
41 | Correct | 22 ms | 2984 KB | Output is correct |
42 | Correct | 21 ms | 2984 KB | Output is correct |
43 | Correct | 4 ms | 2984 KB | Output is correct |
44 | Correct | 6 ms | 2984 KB | Output is correct |
45 | Correct | 8 ms | 2984 KB | Output is correct |
46 | Correct | 11 ms | 2984 KB | Output is correct |
47 | Correct | 8 ms | 2984 KB | Output is correct |
48 | Correct | 10 ms | 2984 KB | Output is correct |
49 | Correct | 11 ms | 2984 KB | Output is correct |
50 | Correct | 11 ms | 2984 KB | Output is correct |
51 | Correct | 12 ms | 2984 KB | Output is correct |
52 | Incorrect | 49 ms | 7672 KB | Output isn't correct |
53 | Halted | 0 ms | 0 KB | - |