# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
45004 | 2018-04-10T14:08:43 Z | RezwanArefin01 | Bali Sculptures (APIO15_sculpture) | C++17 | 3 ms | 1020 KB |
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; int n, A, B, a[2001], f[2010]; ll C[2001][2001]; bool dp[110][110]; int main(int argc, char const *argv[]) { scanf("%d %d %d", &n, &A, &B); for(int i = 1; i <= n; i++) scanf("%d", &a[i]); for(int i = 1; i <= n; i++) { C[i][i] = a[i]; for(int j = i + 1; j <= n; j++) C[i][j] = C[i][j - 1] + a[j]; } ll mask = (1ll << 36) - 1; #define nyc(a, b) ((a & b) == a) if(A == 1) { for(int b = 35; b >= 0; b--) { mask ^= 1ll << b; f[0] = 0; for(int i = 1; i <= n; i++) { f[i] = n + 1; for(int j = 0; j < i; j++) if(nyc(C[j + 1][i], mask)) f[i] = min(f[i], f[j] + 1); } if(f[n] > B) mask ^= 1ll << b; } } else { for(int b = 35; b >= 0; b--) { mask ^= 1ll << b; for(int i = 1; i <= n; i++) dp[1][i] = nyc(C[1][i], mask); for(int k = 2; k <= B; k++) { for(int i = 1; i <= n; i++) { dp[k][i] = 0; for(int j = 1; j < i; j++) dp[k][i] |= (dp[k - 1][j] & nyc(C[j + 1][i], mask)); } } bool f = 0; for(int i = A; i <= B; i++) if(dp[i][n]) f = 1; if(!f) mask ^= 1ll << b; } } printf("%d\n", mask); }
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 | 2 ms | 532 KB | Output is correct |
6 | Correct | 2 ms | 532 KB | Output is correct |
7 | Correct | 3 ms | 564 KB | Output is correct |
8 | Correct | 2 ms | 564 KB | Output is correct |
9 | Correct | 2 ms | 564 KB | Output is correct |
10 | Correct | 2 ms | 612 KB | Output is correct |
11 | Correct | 2 ms | 612 KB | Output is correct |
12 | Correct | 2 ms | 612 KB | Output is correct |
13 | Correct | 2 ms | 612 KB | Output is correct |
14 | Correct | 2 ms | 612 KB | Output is correct |
15 | Correct | 2 ms | 668 KB | Output is correct |
16 | Correct | 2 ms | 668 KB | Output is correct |
17 | Correct | 2 ms | 668 KB | Output is correct |
18 | Correct | 2 ms | 724 KB | Output is correct |
19 | Correct | 2 ms | 724 KB | Output is correct |
20 | Correct | 2 ms | 724 KB | Output is correct |
21 | Correct | 2 ms | 724 KB | Output is correct |
22 | Correct | 2 ms | 724 KB | Output is correct |
23 | Correct | 2 ms | 748 KB | Output is correct |
24 | Correct | 2 ms | 748 KB | Output is correct |
25 | Correct | 2 ms | 748 KB | Output is correct |
26 | Correct | 2 ms | 748 KB | Output is correct |
27 | Correct | 2 ms | 748 KB | Output is correct |
28 | Correct | 2 ms | 748 KB | Output is correct |
29 | Correct | 2 ms | 748 KB | Output is correct |
30 | Incorrect | 2 ms | 748 KB | Output isn't correct |
31 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 748 KB | Output is correct |
2 | Correct | 2 ms | 748 KB | Output is correct |
3 | Correct | 2 ms | 748 KB | Output is correct |
4 | Correct | 2 ms | 748 KB | Output is correct |
5 | Correct | 2 ms | 748 KB | Output is correct |
6 | Correct | 2 ms | 748 KB | Output is correct |
7 | Correct | 2 ms | 748 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 2 ms | 748 KB | Output is correct |
10 | Correct | 2 ms | 748 KB | Output is correct |
11 | Correct | 2 ms | 748 KB | Output is correct |
12 | Correct | 2 ms | 748 KB | Output is correct |
13 | Correct | 2 ms | 748 KB | Output is correct |
14 | Correct | 2 ms | 748 KB | Output is correct |
15 | Correct | 2 ms | 748 KB | Output is correct |
16 | Correct | 2 ms | 748 KB | Output is correct |
17 | Correct | 2 ms | 748 KB | Output is correct |
18 | Correct | 2 ms | 748 KB | Output is correct |
19 | Correct | 2 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 2 ms | 748 KB | Output is correct |
22 | Correct | 2 ms | 748 KB | Output is correct |
23 | Correct | 2 ms | 748 KB | Output is correct |
24 | Correct | 2 ms | 748 KB | Output is correct |
25 | Correct | 2 ms | 748 KB | Output is correct |
26 | Correct | 2 ms | 748 KB | Output is correct |
27 | Correct | 2 ms | 748 KB | Output is correct |
28 | Correct | 2 ms | 748 KB | Output is correct |
29 | Correct | 3 ms | 764 KB | Output is correct |
30 | Correct | 2 ms | 764 KB | Output is correct |
31 | Correct | 2 ms | 764 KB | Output is correct |
32 | Correct | 3 ms | 804 KB | Output is correct |
33 | Correct | 2 ms | 804 KB | Output is correct |
34 | Correct | 2 ms | 804 KB | Output is correct |
35 | Correct | 2 ms | 804 KB | Output is correct |
36 | Correct | 3 ms | 804 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 804 KB | Output is correct |
2 | Correct | 2 ms | 804 KB | Output is correct |
3 | Correct | 2 ms | 804 KB | Output is correct |
4 | Correct | 2 ms | 804 KB | Output is correct |
5 | Correct | 2 ms | 804 KB | Output is correct |
6 | Correct | 3 ms | 804 KB | Output is correct |
7 | Correct | 3 ms | 804 KB | Output is correct |
8 | Correct | 2 ms | 804 KB | Output is correct |
9 | Correct | 2 ms | 804 KB | Output is correct |
10 | Correct | 2 ms | 804 KB | Output is correct |
11 | Correct | 2 ms | 804 KB | Output is correct |
12 | Correct | 2 ms | 804 KB | Output is correct |
13 | Correct | 2 ms | 804 KB | Output is correct |
14 | Correct | 2 ms | 804 KB | Output is correct |
15 | Correct | 2 ms | 804 KB | Output is correct |
16 | Correct | 2 ms | 804 KB | Output is correct |
17 | Correct | 2 ms | 804 KB | Output is correct |
18 | Correct | 2 ms | 832 KB | Output is correct |
19 | Correct | 2 ms | 832 KB | Output is correct |
20 | Correct | 2 ms | 832 KB | Output is correct |
21 | Correct | 2 ms | 832 KB | Output is correct |
22 | Correct | 2 ms | 832 KB | Output is correct |
23 | Correct | 3 ms | 832 KB | Output is correct |
24 | Correct | 2 ms | 832 KB | Output is correct |
25 | Correct | 2 ms | 892 KB | Output is correct |
26 | Correct | 2 ms | 892 KB | Output is correct |
27 | Correct | 3 ms | 1020 KB | Output is correct |
28 | Correct | 3 ms | 1020 KB | Output is correct |
29 | Correct | 3 ms | 1020 KB | Output is correct |
30 | Correct | 3 ms | 1020 KB | Output is correct |
31 | Correct | 3 ms | 1020 KB | Output is correct |
32 | Correct | 2 ms | 1020 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1020 KB | Output is correct |
2 | Correct | 2 ms | 1020 KB | Output is correct |
3 | Correct | 2 ms | 1020 KB | Output is correct |
4 | Correct | 2 ms | 1020 KB | Output is correct |
5 | Correct | 2 ms | 1020 KB | Output is correct |
6 | Correct | 2 ms | 1020 KB | Output is correct |
7 | Correct | 2 ms | 1020 KB | Output is correct |
8 | Correct | 2 ms | 1020 KB | Output is correct |
9 | Correct | 2 ms | 1020 KB | Output is correct |
10 | Correct | 2 ms | 1020 KB | Output is correct |
11 | Correct | 2 ms | 1020 KB | Output is correct |
12 | Correct | 2 ms | 1020 KB | Output is correct |
13 | Correct | 2 ms | 1020 KB | Output is correct |
14 | Correct | 2 ms | 1020 KB | Output is correct |
15 | Correct | 2 ms | 1020 KB | Output is correct |
16 | Correct | 2 ms | 1020 KB | Output is correct |
17 | Correct | 2 ms | 1020 KB | Output is correct |
18 | Correct | 2 ms | 1020 KB | Output is correct |
19 | Correct | 2 ms | 1020 KB | Output is correct |
20 | Correct | 2 ms | 1020 KB | Output is correct |
21 | Correct | 2 ms | 1020 KB | Output is correct |
22 | Correct | 2 ms | 1020 KB | Output is correct |
23 | Correct | 3 ms | 1020 KB | Output is correct |
24 | Correct | 2 ms | 1020 KB | Output is correct |
25 | Correct | 2 ms | 1020 KB | Output is correct |
26 | Correct | 2 ms | 1020 KB | Output is correct |
27 | Correct | 2 ms | 1020 KB | Output is correct |
28 | Correct | 2 ms | 1020 KB | Output is correct |
29 | Correct | 2 ms | 1020 KB | Output is correct |
30 | Incorrect | 2 ms | 1020 KB | Output isn't correct |
31 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1020 KB | Output is correct |
2 | Correct | 2 ms | 1020 KB | Output is correct |
3 | Correct | 2 ms | 1020 KB | Output is correct |
4 | Correct | 2 ms | 1020 KB | Output is correct |
5 | Correct | 2 ms | 1020 KB | Output is correct |
6 | Correct | 2 ms | 1020 KB | Output is correct |
7 | Correct | 2 ms | 1020 KB | Output is correct |
8 | Correct | 2 ms | 1020 KB | Output is correct |
9 | Correct | 2 ms | 1020 KB | Output is correct |
10 | Correct | 2 ms | 1020 KB | Output is correct |
11 | Correct | 2 ms | 1020 KB | Output is correct |
12 | Correct | 2 ms | 1020 KB | Output is correct |
13 | Correct | 2 ms | 1020 KB | Output is correct |
14 | Correct | 2 ms | 1020 KB | Output is correct |
15 | Correct | 2 ms | 1020 KB | Output is correct |
16 | Correct | 2 ms | 1020 KB | Output is correct |
17 | Incorrect | 2 ms | 1020 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |