# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49432 | 2018-05-28T19:44:55 Z | wzy | Bali Sculptures (APIO15_sculpture) | C++11 | 655 ms | 7036 KB |
#include <bits/stdc++.h> using namespace std; #define int long long int n , a , b; int v[3000]; int c[2500][2500]; bool dp[2500][2500]; int mask; bool vis[2500][2500]; bool can(int i , int j){ if(i == n + 1){ if(a <= j && j <= b) return 1; else return 0; } if(vis[i][j]) return dp[i][j]; vis[i][j] = 1; for(int w = i ; w <= n ; w++){ if((c[i][w] & mask) == 0){ dp[i][j] = max(dp[i][j] , can(w + 1 , j + 1)); } } return dp[i][j]; } int32_t main(){ scanf("%lld%lld%lld" , &n , &a , &b); for(int i = 1 ; i <= n; i ++) scanf("%lld" , &v[i]); for(int i = 1 ; i <= n; i ++){ c[i][i] = v[i]; for(int j = i + 1 ; j <= n; j ++) c[i][j] = c[i][j-1] + v[j]; } int dontpick = 0; for(int j = 40 ; j >= 0 ; j--){ mask = dontpick + (1LL<<j); for(int i = 0 ; i <= 300 ; i++) for(int j = 0 ; j <= 300 ; j++) dp[i][j] = 0 , vis[i][j] = 0; dontpick += (1LL<<j) * can(1 , 0); } int U = (1LL<<41) - 1; printf("%lld\n" , U ^ dontpick); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1784 KB | Output is correct |
2 | Correct | 9 ms | 1892 KB | Output is correct |
3 | Correct | 9 ms | 1968 KB | Output is correct |
4 | Correct | 9 ms | 1968 KB | Output is correct |
5 | Correct | 9 ms | 2080 KB | Output is correct |
6 | Correct | 9 ms | 2096 KB | Output is correct |
7 | Correct | 9 ms | 2100 KB | Output is correct |
8 | Correct | 9 ms | 2216 KB | Output is correct |
9 | Correct | 10 ms | 2216 KB | Output is correct |
10 | Correct | 10 ms | 2216 KB | Output is correct |
11 | Correct | 10 ms | 2216 KB | Output is correct |
12 | Correct | 10 ms | 2216 KB | Output is correct |
13 | Correct | 10 ms | 2216 KB | Output is correct |
14 | Correct | 9 ms | 2216 KB | Output is correct |
15 | Correct | 10 ms | 2216 KB | Output is correct |
16 | Correct | 9 ms | 2216 KB | Output is correct |
17 | Correct | 10 ms | 2216 KB | Output is correct |
18 | Correct | 10 ms | 2216 KB | Output is correct |
19 | Correct | 10 ms | 2216 KB | Output is correct |
20 | Correct | 10 ms | 2272 KB | Output is correct |
21 | Correct | 11 ms | 2272 KB | Output is correct |
22 | Correct | 11 ms | 2272 KB | Output is correct |
23 | Correct | 14 ms | 2272 KB | Output is correct |
24 | Correct | 11 ms | 2272 KB | Output is correct |
25 | Correct | 10 ms | 2272 KB | Output is correct |
26 | Correct | 10 ms | 2272 KB | Output is correct |
27 | Correct | 9 ms | 2272 KB | Output is correct |
28 | Correct | 10 ms | 2272 KB | Output is correct |
29 | Correct | 10 ms | 2272 KB | Output is correct |
30 | Correct | 12 ms | 2272 KB | Output is correct |
31 | Correct | 9 ms | 2272 KB | Output is correct |
32 | Correct | 11 ms | 2284 KB | Output is correct |
33 | Correct | 9 ms | 2284 KB | Output is correct |
34 | Correct | 9 ms | 2284 KB | Output is correct |
35 | Correct | 9 ms | 2296 KB | Output is correct |
36 | Correct | 10 ms | 2296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 2296 KB | Output is correct |
2 | Correct | 10 ms | 2296 KB | Output is correct |
3 | Correct | 11 ms | 2296 KB | Output is correct |
4 | Correct | 11 ms | 2296 KB | Output is correct |
5 | Correct | 9 ms | 2296 KB | Output is correct |
6 | Correct | 10 ms | 2296 KB | Output is correct |
7 | Correct | 11 ms | 2296 KB | Output is correct |
8 | Correct | 12 ms | 2296 KB | Output is correct |
9 | Correct | 10 ms | 2296 KB | Output is correct |
10 | Correct | 13 ms | 2296 KB | Output is correct |
11 | Correct | 10 ms | 2296 KB | Output is correct |
12 | Correct | 11 ms | 2300 KB | Output is correct |
13 | Correct | 10 ms | 2300 KB | Output is correct |
14 | Correct | 12 ms | 2300 KB | Output is correct |
15 | Correct | 10 ms | 2300 KB | Output is correct |
16 | Correct | 10 ms | 2300 KB | Output is correct |
17 | Correct | 10 ms | 2300 KB | Output is correct |
18 | Correct | 9 ms | 2300 KB | Output is correct |
19 | Correct | 10 ms | 2300 KB | Output is correct |
20 | Correct | 9 ms | 2300 KB | Output is correct |
21 | Correct | 10 ms | 2300 KB | Output is correct |
22 | Correct | 10 ms | 2300 KB | Output is correct |
23 | Correct | 9 ms | 2300 KB | Output is correct |
24 | Correct | 12 ms | 2300 KB | Output is correct |
25 | Correct | 9 ms | 2300 KB | Output is correct |
26 | Correct | 10 ms | 2300 KB | Output is correct |
27 | Correct | 13 ms | 2300 KB | Output is correct |
28 | Correct | 10 ms | 2300 KB | Output is correct |
29 | Correct | 12 ms | 2300 KB | Output is correct |
30 | Correct | 12 ms | 2308 KB | Output is correct |
31 | Correct | 13 ms | 2320 KB | Output is correct |
32 | Correct | 14 ms | 2320 KB | Output is correct |
33 | Correct | 13 ms | 2320 KB | Output is correct |
34 | Correct | 14 ms | 2320 KB | Output is correct |
35 | Correct | 14 ms | 2320 KB | Output is correct |
36 | Correct | 15 ms | 2320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 2320 KB | Output is correct |
2 | Correct | 11 ms | 2320 KB | Output is correct |
3 | Correct | 10 ms | 2320 KB | Output is correct |
4 | Correct | 11 ms | 2320 KB | Output is correct |
5 | Correct | 9 ms | 2320 KB | Output is correct |
6 | Correct | 10 ms | 2320 KB | Output is correct |
7 | Correct | 10 ms | 2320 KB | Output is correct |
8 | Correct | 9 ms | 2320 KB | Output is correct |
9 | Correct | 10 ms | 2320 KB | Output is correct |
10 | Correct | 10 ms | 2320 KB | Output is correct |
11 | Correct | 12 ms | 2320 KB | Output is correct |
12 | Correct | 12 ms | 2320 KB | Output is correct |
13 | Correct | 9 ms | 2320 KB | Output is correct |
14 | Correct | 13 ms | 2320 KB | Output is correct |
15 | Correct | 12 ms | 2320 KB | Output is correct |
16 | Correct | 12 ms | 2320 KB | Output is correct |
17 | Correct | 11 ms | 2320 KB | Output is correct |
18 | Correct | 17 ms | 2320 KB | Output is correct |
19 | Correct | 14 ms | 2320 KB | Output is correct |
20 | Correct | 18 ms | 2320 KB | Output is correct |
21 | Correct | 13 ms | 2320 KB | Output is correct |
22 | Correct | 16 ms | 2320 KB | Output is correct |
23 | Correct | 15 ms | 2320 KB | Output is correct |
24 | Correct | 16 ms | 2320 KB | Output is correct |
25 | Correct | 20 ms | 2320 KB | Output is correct |
26 | Correct | 27 ms | 2428 KB | Output is correct |
27 | Correct | 39 ms | 2432 KB | Output is correct |
28 | Correct | 40 ms | 2556 KB | Output is correct |
29 | Correct | 41 ms | 2684 KB | Output is correct |
30 | Correct | 43 ms | 2684 KB | Output is correct |
31 | Correct | 42 ms | 2684 KB | Output is correct |
32 | Correct | 42 ms | 2684 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 2684 KB | Output is correct |
2 | Correct | 11 ms | 2684 KB | Output is correct |
3 | Correct | 10 ms | 2684 KB | Output is correct |
4 | Correct | 10 ms | 2684 KB | Output is correct |
5 | Correct | 10 ms | 2684 KB | Output is correct |
6 | Correct | 11 ms | 2684 KB | Output is correct |
7 | Correct | 12 ms | 2684 KB | Output is correct |
8 | Correct | 11 ms | 2684 KB | Output is correct |
9 | Correct | 9 ms | 2684 KB | Output is correct |
10 | Correct | 14 ms | 2684 KB | Output is correct |
11 | Correct | 13 ms | 2684 KB | Output is correct |
12 | Correct | 10 ms | 2684 KB | Output is correct |
13 | Correct | 10 ms | 2684 KB | Output is correct |
14 | Correct | 9 ms | 2684 KB | Output is correct |
15 | Correct | 9 ms | 2684 KB | Output is correct |
16 | Correct | 10 ms | 2684 KB | Output is correct |
17 | Correct | 9 ms | 2684 KB | Output is correct |
18 | Correct | 9 ms | 2684 KB | Output is correct |
19 | Correct | 12 ms | 2684 KB | Output is correct |
20 | Correct | 10 ms | 2684 KB | Output is correct |
21 | Correct | 9 ms | 2684 KB | Output is correct |
22 | Correct | 10 ms | 2684 KB | Output is correct |
23 | Correct | 10 ms | 2684 KB | Output is correct |
24 | Correct | 10 ms | 2684 KB | Output is correct |
25 | Correct | 12 ms | 2684 KB | Output is correct |
26 | Correct | 13 ms | 2684 KB | Output is correct |
27 | Correct | 9 ms | 2684 KB | Output is correct |
28 | Correct | 10 ms | 2684 KB | Output is correct |
29 | Correct | 10 ms | 2684 KB | Output is correct |
30 | Correct | 10 ms | 2684 KB | Output is correct |
31 | Correct | 9 ms | 2684 KB | Output is correct |
32 | Correct | 8 ms | 2684 KB | Output is correct |
33 | Correct | 10 ms | 2684 KB | Output is correct |
34 | Correct | 9 ms | 2684 KB | Output is correct |
35 | Correct | 11 ms | 2684 KB | Output is correct |
36 | Correct | 12 ms | 2684 KB | Output is correct |
37 | Correct | 11 ms | 2684 KB | Output is correct |
38 | Correct | 9 ms | 2684 KB | Output is correct |
39 | Correct | 13 ms | 2684 KB | Output is correct |
40 | Correct | 13 ms | 2684 KB | Output is correct |
41 | Correct | 16 ms | 2684 KB | Output is correct |
42 | Correct | 19 ms | 2684 KB | Output is correct |
43 | Correct | 13 ms | 2684 KB | Output is correct |
44 | Correct | 14 ms | 2684 KB | Output is correct |
45 | Correct | 14 ms | 2684 KB | Output is correct |
46 | Correct | 16 ms | 2684 KB | Output is correct |
47 | Correct | 14 ms | 2684 KB | Output is correct |
48 | Correct | 18 ms | 2684 KB | Output is correct |
49 | Correct | 24 ms | 2684 KB | Output is correct |
50 | Correct | 38 ms | 2684 KB | Output is correct |
51 | Correct | 41 ms | 2684 KB | Output is correct |
52 | Correct | 57 ms | 2684 KB | Output is correct |
53 | Correct | 51 ms | 2684 KB | Output is correct |
54 | Correct | 40 ms | 2684 KB | Output is correct |
55 | Correct | 40 ms | 2684 KB | Output is correct |
56 | Correct | 11 ms | 2684 KB | Output is correct |
57 | Correct | 13 ms | 2684 KB | Output is correct |
58 | Correct | 16 ms | 2684 KB | Output is correct |
59 | Correct | 18 ms | 2684 KB | Output is correct |
60 | Correct | 18 ms | 2684 KB | Output is correct |
61 | Correct | 21 ms | 2684 KB | Output is correct |
62 | Correct | 20 ms | 2684 KB | Output is correct |
63 | Correct | 20 ms | 2684 KB | Output is correct |
64 | Correct | 34 ms | 2684 KB | Output is correct |
65 | Correct | 11 ms | 2684 KB | Output is correct |
66 | Correct | 12 ms | 2684 KB | Output is correct |
67 | Correct | 12 ms | 2684 KB | Output is correct |
68 | Correct | 16 ms | 2684 KB | Output is correct |
69 | Correct | 17 ms | 2684 KB | Output is correct |
70 | Correct | 19 ms | 2684 KB | Output is correct |
71 | Correct | 18 ms | 2684 KB | Output is correct |
72 | Correct | 24 ms | 2684 KB | Output is correct |
73 | Correct | 20 ms | 2684 KB | Output is correct |
74 | Correct | 22 ms | 2684 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 2684 KB | Output is correct |
2 | Correct | 9 ms | 2684 KB | Output is correct |
3 | Correct | 10 ms | 2684 KB | Output is correct |
4 | Correct | 10 ms | 2684 KB | Output is correct |
5 | Correct | 9 ms | 2684 KB | Output is correct |
6 | Correct | 9 ms | 2684 KB | Output is correct |
7 | Correct | 10 ms | 2684 KB | Output is correct |
8 | Correct | 10 ms | 2684 KB | Output is correct |
9 | Correct | 10 ms | 2684 KB | Output is correct |
10 | Correct | 9 ms | 2684 KB | Output is correct |
11 | Correct | 9 ms | 2684 KB | Output is correct |
12 | Correct | 10 ms | 2684 KB | Output is correct |
13 | Correct | 9 ms | 2684 KB | Output is correct |
14 | Correct | 10 ms | 2684 KB | Output is correct |
15 | Correct | 9 ms | 2684 KB | Output is correct |
16 | Correct | 11 ms | 2684 KB | Output is correct |
17 | Correct | 10 ms | 2684 KB | Output is correct |
18 | Correct | 10 ms | 2684 KB | Output is correct |
19 | Correct | 10 ms | 2684 KB | Output is correct |
20 | Correct | 9 ms | 2684 KB | Output is correct |
21 | Correct | 9 ms | 2684 KB | Output is correct |
22 | Correct | 10 ms | 2684 KB | Output is correct |
23 | Correct | 9 ms | 2684 KB | Output is correct |
24 | Correct | 10 ms | 2684 KB | Output is correct |
25 | Correct | 9 ms | 2684 KB | Output is correct |
26 | Correct | 11 ms | 2684 KB | Output is correct |
27 | Correct | 12 ms | 2684 KB | Output is correct |
28 | Correct | 15 ms | 2684 KB | Output is correct |
29 | Correct | 15 ms | 2684 KB | Output is correct |
30 | Correct | 15 ms | 2684 KB | Output is correct |
31 | Correct | 14 ms | 2684 KB | Output is correct |
32 | Correct | 14 ms | 2684 KB | Output is correct |
33 | Correct | 14 ms | 2684 KB | Output is correct |
34 | Correct | 14 ms | 2684 KB | Output is correct |
35 | Correct | 17 ms | 2684 KB | Output is correct |
36 | Correct | 27 ms | 2684 KB | Output is correct |
37 | Correct | 32 ms | 2684 KB | Output is correct |
38 | Correct | 42 ms | 2684 KB | Output is correct |
39 | Correct | 40 ms | 2684 KB | Output is correct |
40 | Correct | 41 ms | 2684 KB | Output is correct |
41 | Correct | 39 ms | 2684 KB | Output is correct |
42 | Correct | 40 ms | 2684 KB | Output is correct |
43 | Correct | 10 ms | 2684 KB | Output is correct |
44 | Correct | 14 ms | 2684 KB | Output is correct |
45 | Correct | 16 ms | 2684 KB | Output is correct |
46 | Correct | 18 ms | 2684 KB | Output is correct |
47 | Correct | 16 ms | 2684 KB | Output is correct |
48 | Correct | 18 ms | 2684 KB | Output is correct |
49 | Correct | 19 ms | 2684 KB | Output is correct |
50 | Correct | 20 ms | 2684 KB | Output is correct |
51 | Correct | 20 ms | 2684 KB | Output is correct |
52 | Incorrect | 655 ms | 7036 KB | Output isn't correct |
53 | Halted | 0 ms | 0 KB | - |