# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
49443 | 2018-05-29T04:44:21 Z | wzy | Bali Sculptures (APIO15_sculpture) | C++11 | 427 ms | 24496 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]; int cg[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; if(a != 1){ 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); } else{ for(int j = 40 ; j >=0 ; j--){ mask = dontpick + (1LL<<j); for(int i = 0 ; i <= n ; i++){ cg[i] = 10000000; } cg[0] = 0; for(int i = 1 ; i <= n ; i ++){ for(int jw = i ; jw >= 1 ; jw--){ if((c[jw][i] & mask) == 0){ cg[i] = min(cg[jw-1] + 1 , cg[i]); } } } if(cg[n] <= b){ dontpick += (1LL<<j); } } int U = (1LL<<41) - 1; printf("%lld\n" , U ^ dontpick); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 428 KB | Output is correct |
4 | Correct | 2 ms | 480 KB | Output is correct |
5 | Correct | 3 ms | 512 KB | Output is correct |
6 | Correct | 2 ms | 588 KB | Output is correct |
7 | Correct | 2 ms | 588 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 ms | 744 KB | Output is correct |
10 | Correct | 2 ms | 744 KB | Output is correct |
11 | Correct | 2 ms | 744 KB | Output is correct |
12 | Correct | 2 ms | 744 KB | Output is correct |
13 | Correct | 2 ms | 744 KB | Output is correct |
14 | Correct | 12 ms | 2024 KB | Output is correct |
15 | Correct | 9 ms | 2024 KB | Output is correct |
16 | Correct | 10 ms | 2028 KB | Output is correct |
17 | Correct | 10 ms | 2028 KB | Output is correct |
18 | Correct | 9 ms | 2028 KB | Output is correct |
19 | Correct | 9 ms | 2164 KB | Output is correct |
20 | Correct | 9 ms | 2164 KB | Output is correct |
21 | Correct | 10 ms | 2164 KB | Output is correct |
22 | Correct | 8 ms | 2164 KB | Output is correct |
23 | Correct | 8 ms | 2284 KB | Output is correct |
24 | Correct | 9 ms | 2284 KB | Output is correct |
25 | Correct | 9 ms | 2284 KB | Output is correct |
26 | Correct | 8 ms | 2284 KB | Output is correct |
27 | Correct | 2 ms | 2284 KB | Output is correct |
28 | Correct | 2 ms | 2284 KB | Output is correct |
29 | Correct | 3 ms | 2284 KB | Output is correct |
30 | Correct | 2 ms | 2284 KB | Output is correct |
31 | Correct | 3 ms | 2284 KB | Output is correct |
32 | Correct | 3 ms | 2284 KB | Output is correct |
33 | Correct | 2 ms | 2284 KB | Output is correct |
34 | Correct | 3 ms | 2284 KB | Output is correct |
35 | Correct | 2 ms | 2284 KB | Output is correct |
36 | Correct | 2 ms | 2284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2284 KB | Output is correct |
2 | Correct | 2 ms | 2284 KB | Output is correct |
3 | Correct | 2 ms | 2284 KB | Output is correct |
4 | Correct | 2 ms | 2284 KB | Output is correct |
5 | Correct | 2 ms | 2284 KB | Output is correct |
6 | Correct | 2 ms | 2284 KB | Output is correct |
7 | Correct | 2 ms | 2284 KB | Output is correct |
8 | Correct | 2 ms | 2284 KB | Output is correct |
9 | Correct | 3 ms | 2284 KB | Output is correct |
10 | Correct | 2 ms | 2284 KB | Output is correct |
11 | Correct | 2 ms | 2284 KB | Output is correct |
12 | Correct | 2 ms | 2284 KB | Output is correct |
13 | Correct | 2 ms | 2284 KB | Output is correct |
14 | Correct | 10 ms | 2284 KB | Output is correct |
15 | Correct | 8 ms | 2284 KB | Output is correct |
16 | Correct | 10 ms | 2284 KB | Output is correct |
17 | Correct | 8 ms | 2284 KB | Output is correct |
18 | Correct | 9 ms | 2284 KB | Output is correct |
19 | Correct | 9 ms | 2284 KB | Output is correct |
20 | Correct | 9 ms | 2284 KB | Output is correct |
21 | Correct | 9 ms | 2284 KB | Output is correct |
22 | Correct | 10 ms | 2284 KB | Output is correct |
23 | Correct | 9 ms | 2284 KB | Output is correct |
24 | Correct | 13 ms | 2284 KB | Output is correct |
25 | Correct | 10 ms | 2284 KB | Output is correct |
26 | Correct | 10 ms | 2284 KB | Output is correct |
27 | Correct | 2 ms | 2284 KB | Output is correct |
28 | Correct | 2 ms | 2284 KB | Output is correct |
29 | Correct | 3 ms | 2284 KB | Output is correct |
30 | Correct | 2 ms | 2284 KB | Output is correct |
31 | Correct | 2 ms | 2284 KB | Output is correct |
32 | Correct | 3 ms | 2284 KB | Output is correct |
33 | Correct | 3 ms | 2284 KB | Output is correct |
34 | Correct | 3 ms | 2284 KB | Output is correct |
35 | Correct | 3 ms | 2284 KB | Output is correct |
36 | Correct | 3 ms | 2284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2284 KB | Output is correct |
2 | Correct | 2 ms | 2284 KB | Output is correct |
3 | Correct | 2 ms | 2284 KB | Output is correct |
4 | Correct | 2 ms | 2284 KB | Output is correct |
5 | Correct | 2 ms | 2284 KB | Output is correct |
6 | Correct | 2 ms | 2284 KB | Output is correct |
7 | Correct | 2 ms | 2284 KB | Output is correct |
8 | Correct | 2 ms | 2284 KB | Output is correct |
9 | Correct | 2 ms | 2284 KB | Output is correct |
10 | Correct | 3 ms | 2284 KB | Output is correct |
11 | Correct | 3 ms | 2284 KB | Output is correct |
12 | Correct | 2 ms | 2284 KB | Output is correct |
13 | Correct | 2 ms | 2284 KB | Output is correct |
14 | Correct | 3 ms | 2284 KB | Output is correct |
15 | Correct | 3 ms | 2284 KB | Output is correct |
16 | Correct | 2 ms | 2284 KB | Output is correct |
17 | Correct | 2 ms | 2284 KB | Output is correct |
18 | Correct | 2 ms | 2284 KB | Output is correct |
19 | Correct | 2 ms | 2284 KB | Output is correct |
20 | Correct | 3 ms | 2284 KB | Output is correct |
21 | Correct | 3 ms | 2284 KB | Output is correct |
22 | Correct | 2 ms | 2284 KB | Output is correct |
23 | Correct | 3 ms | 2284 KB | Output is correct |
24 | Correct | 3 ms | 2284 KB | Output is correct |
25 | Correct | 3 ms | 2284 KB | Output is correct |
26 | Correct | 3 ms | 2284 KB | Output is correct |
27 | Correct | 4 ms | 2284 KB | Output is correct |
28 | Correct | 4 ms | 2284 KB | Output is correct |
29 | Correct | 4 ms | 2284 KB | Output is correct |
30 | Correct | 3 ms | 2284 KB | Output is correct |
31 | Correct | 4 ms | 2284 KB | Output is correct |
32 | Correct | 3 ms | 2284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2284 KB | Output is correct |
2 | Correct | 2 ms | 2284 KB | Output is correct |
3 | Correct | 3 ms | 2284 KB | Output is correct |
4 | Correct | 2 ms | 2284 KB | Output is correct |
5 | Correct | 2 ms | 2284 KB | Output is correct |
6 | Correct | 2 ms | 2284 KB | Output is correct |
7 | Correct | 2 ms | 2284 KB | Output is correct |
8 | Correct | 2 ms | 2284 KB | Output is correct |
9 | Correct | 2 ms | 2284 KB | Output is correct |
10 | Correct | 2 ms | 2284 KB | Output is correct |
11 | Correct | 2 ms | 2284 KB | Output is correct |
12 | Correct | 4 ms | 2284 KB | Output is correct |
13 | Correct | 2 ms | 2284 KB | Output is correct |
14 | Correct | 9 ms | 2284 KB | Output is correct |
15 | Correct | 9 ms | 2284 KB | Output is correct |
16 | Correct | 9 ms | 2284 KB | Output is correct |
17 | Correct | 10 ms | 2284 KB | Output is correct |
18 | Correct | 9 ms | 2284 KB | Output is correct |
19 | Correct | 10 ms | 2284 KB | Output is correct |
20 | Correct | 11 ms | 2284 KB | Output is correct |
21 | Correct | 10 ms | 2284 KB | Output is correct |
22 | Correct | 9 ms | 2284 KB | Output is correct |
23 | Correct | 14 ms | 2300 KB | Output is correct |
24 | Correct | 10 ms | 2300 KB | Output is correct |
25 | Correct | 10 ms | 2300 KB | Output is correct |
26 | Correct | 11 ms | 2300 KB | Output is correct |
27 | Correct | 3 ms | 2300 KB | Output is correct |
28 | Correct | 2 ms | 2300 KB | Output is correct |
29 | Correct | 2 ms | 2300 KB | Output is correct |
30 | Correct | 2 ms | 2300 KB | Output is correct |
31 | Correct | 2 ms | 2300 KB | Output is correct |
32 | Correct | 2 ms | 2300 KB | Output is correct |
33 | Correct | 2 ms | 2300 KB | Output is correct |
34 | Correct | 2 ms | 2300 KB | Output is correct |
35 | Correct | 3 ms | 2300 KB | Output is correct |
36 | Correct | 2 ms | 2300 KB | Output is correct |
37 | Correct | 2 ms | 2300 KB | Output is correct |
38 | Correct | 2 ms | 2300 KB | Output is correct |
39 | Correct | 2 ms | 2300 KB | Output is correct |
40 | Correct | 2 ms | 2300 KB | Output is correct |
41 | Correct | 3 ms | 2300 KB | Output is correct |
42 | Correct | 3 ms | 2300 KB | Output is correct |
43 | Correct | 3 ms | 2300 KB | Output is correct |
44 | Correct | 3 ms | 2300 KB | Output is correct |
45 | Correct | 2 ms | 2300 KB | Output is correct |
46 | Correct | 3 ms | 2300 KB | Output is correct |
47 | Correct | 3 ms | 2300 KB | Output is correct |
48 | Correct | 2 ms | 2300 KB | Output is correct |
49 | Correct | 3 ms | 2300 KB | Output is correct |
50 | Correct | 3 ms | 2300 KB | Output is correct |
51 | Correct | 3 ms | 2300 KB | Output is correct |
52 | Correct | 3 ms | 2300 KB | Output is correct |
53 | Correct | 3 ms | 2300 KB | Output is correct |
54 | Correct | 3 ms | 2300 KB | Output is correct |
55 | Correct | 3 ms | 2300 KB | Output is correct |
56 | Correct | 2 ms | 2300 KB | Output is correct |
57 | Correct | 3 ms | 2300 KB | Output is correct |
58 | Correct | 3 ms | 2300 KB | Output is correct |
59 | Correct | 4 ms | 2300 KB | Output is correct |
60 | Correct | 2 ms | 2300 KB | Output is correct |
61 | Correct | 2 ms | 2300 KB | Output is correct |
62 | Correct | 3 ms | 2300 KB | Output is correct |
63 | Correct | 4 ms | 2300 KB | Output is correct |
64 | Correct | 32 ms | 2484 KB | Output is correct |
65 | Correct | 9 ms | 2484 KB | Output is correct |
66 | Correct | 10 ms | 2484 KB | Output is correct |
67 | Correct | 11 ms | 2484 KB | Output is correct |
68 | Correct | 14 ms | 2484 KB | Output is correct |
69 | Correct | 15 ms | 2484 KB | Output is correct |
70 | Correct | 14 ms | 2580 KB | Output is correct |
71 | Correct | 15 ms | 2580 KB | Output is correct |
72 | Correct | 17 ms | 2580 KB | Output is correct |
73 | Correct | 19 ms | 2580 KB | Output is correct |
74 | Correct | 17 ms | 2580 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2580 KB | Output is correct |
2 | Correct | 2 ms | 2580 KB | Output is correct |
3 | Correct | 2 ms | 2580 KB | Output is correct |
4 | Correct | 2 ms | 2580 KB | Output is correct |
5 | Correct | 2 ms | 2580 KB | Output is correct |
6 | Correct | 2 ms | 2580 KB | Output is correct |
7 | Correct | 2 ms | 2580 KB | Output is correct |
8 | Correct | 3 ms | 2580 KB | Output is correct |
9 | Correct | 2 ms | 2580 KB | Output is correct |
10 | Correct | 3 ms | 2580 KB | Output is correct |
11 | Correct | 2 ms | 2580 KB | Output is correct |
12 | Correct | 2 ms | 2580 KB | Output is correct |
13 | Correct | 2 ms | 2580 KB | Output is correct |
14 | Correct | 2 ms | 2580 KB | Output is correct |
15 | Correct | 2 ms | 2580 KB | Output is correct |
16 | Correct | 2 ms | 2580 KB | Output is correct |
17 | Correct | 2 ms | 2580 KB | Output is correct |
18 | Correct | 2 ms | 2580 KB | Output is correct |
19 | Correct | 2 ms | 2580 KB | Output is correct |
20 | Correct | 3 ms | 2580 KB | Output is correct |
21 | Correct | 2 ms | 2580 KB | Output is correct |
22 | Correct | 2 ms | 2580 KB | Output is correct |
23 | Correct | 2 ms | 2580 KB | Output is correct |
24 | Correct | 3 ms | 2580 KB | Output is correct |
25 | Correct | 2 ms | 2580 KB | Output is correct |
26 | Correct | 3 ms | 2580 KB | Output is correct |
27 | Correct | 2 ms | 2580 KB | Output is correct |
28 | Correct | 2 ms | 2580 KB | Output is correct |
29 | Correct | 3 ms | 2580 KB | Output is correct |
30 | Correct | 3 ms | 2580 KB | Output is correct |
31 | Correct | 2 ms | 2580 KB | Output is correct |
32 | Correct | 2 ms | 2580 KB | Output is correct |
33 | Correct | 2 ms | 2580 KB | Output is correct |
34 | Correct | 3 ms | 2580 KB | Output is correct |
35 | Correct | 2 ms | 2580 KB | Output is correct |
36 | Correct | 3 ms | 2580 KB | Output is correct |
37 | Correct | 3 ms | 2580 KB | Output is correct |
38 | Correct | 4 ms | 2580 KB | Output is correct |
39 | Correct | 0 ms | 2580 KB | Output is correct |
40 | Correct | 4 ms | 2580 KB | Output is correct |
41 | Correct | 3 ms | 2580 KB | Output is correct |
42 | Correct | 3 ms | 2580 KB | Output is correct |
43 | Correct | 2 ms | 2580 KB | Output is correct |
44 | Correct | 3 ms | 2580 KB | Output is correct |
45 | Correct | 3 ms | 2580 KB | Output is correct |
46 | Correct | 3 ms | 2580 KB | Output is correct |
47 | Correct | 3 ms | 2580 KB | Output is correct |
48 | Correct | 3 ms | 2580 KB | Output is correct |
49 | Correct | 3 ms | 2580 KB | Output is correct |
50 | Correct | 3 ms | 2580 KB | Output is correct |
51 | Correct | 3 ms | 2580 KB | Output is correct |
52 | Correct | 20 ms | 4220 KB | Output is correct |
53 | Correct | 27 ms | 5756 KB | Output is correct |
54 | Correct | 115 ms | 8576 KB | Output is correct |
55 | Correct | 55 ms | 8604 KB | Output is correct |
56 | Correct | 394 ms | 24444 KB | Output is correct |
57 | Correct | 375 ms | 24496 KB | Output is correct |
58 | Correct | 427 ms | 24496 KB | Output is correct |
59 | Correct | 384 ms | 24496 KB | Output is correct |
60 | Correct | 385 ms | 24496 KB | Output is correct |
61 | Correct | 3 ms | 24496 KB | Output is correct |
62 | Correct | 26 ms | 24496 KB | Output is correct |
63 | Correct | 48 ms | 24496 KB | Output is correct |
64 | Correct | 50 ms | 24496 KB | Output is correct |
65 | Correct | 162 ms | 24496 KB | Output is correct |
66 | Correct | 273 ms | 24496 KB | Output is correct |
67 | Correct | 414 ms | 24496 KB | Output is correct |
68 | Correct | 391 ms | 24496 KB | Output is correct |
69 | Correct | 392 ms | 24496 KB | Output is correct |