# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370251 | 2021-02-23T15:36:09 Z | BartolM | Bali Sculptures (APIO15_sculpture) | C++17 | 40 ms | 896 KB |
#include <bits/stdc++.h> using namespace std; #define X first #define Y second #define mp make_pair #define pb push_back typedef long long ll; typedef pair <int, int> pii; typedef pair <int, pii> pip; typedef pair <pii, int> ppi; typedef pair <ll, ll> pll; const int INF=0x3f3f3f3f; const int LOG=45; const int N=2005; int n, A, B; ll pref[N]; int dp[N][N]; int f(ll mask) { // memset(dp, 0, sizeof dp); dp[0][0]=1; for (int i=1; i<=n; ++i) { for (int j=1; j<=i; ++j) { dp[i][j]=0; for (int k=0; k<i; ++k) { if ((mask | (pref[i]-pref[k]))!=mask) continue; dp[i][j]|=dp[k][j-1]; } } } for (int i=A; i<=B; ++i) if (dp[n][i]) return 1; return 0; } void solve() { ll sol=(1LL<<(LOG+1))-1; for (int i=LOG; i>=0; --i) { if (f(sol^(1LL<<i))) sol^=(1LL<<i); } printf("%lld\n", sol); } void load() { scanf("%d %d %d", &n, &A, &B); for (int i=1; i<=n; ++i) { scanf("%lld", &pref[i]); pref[i]+=pref[i-1]; } } int main() { load(); assert(n<=100); solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 512 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 1 ms | 364 KB | Output is correct |
28 | Correct | 1 ms | 364 KB | Output is correct |
29 | Correct | 1 ms | 364 KB | Output is correct |
30 | Correct | 1 ms | 364 KB | Output is correct |
31 | Correct | 1 ms | 364 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 1 ms | 364 KB | Output is correct |
34 | Correct | 1 ms | 364 KB | Output is correct |
35 | Correct | 40 ms | 364 KB | Output is correct |
36 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 380 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 1 ms | 364 KB | Output is correct |
28 | Correct | 1 ms | 364 KB | Output is correct |
29 | Correct | 3 ms | 492 KB | Output is correct |
30 | Correct | 3 ms | 492 KB | Output is correct |
31 | Correct | 5 ms | 492 KB | Output is correct |
32 | Correct | 5 ms | 492 KB | Output is correct |
33 | Correct | 5 ms | 512 KB | Output is correct |
34 | Correct | 5 ms | 492 KB | Output is correct |
35 | Correct | 5 ms | 492 KB | Output is correct |
36 | Correct | 5 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 2 ms | 492 KB | Output is correct |
17 | Correct | 4 ms | 492 KB | Output is correct |
18 | Correct | 6 ms | 492 KB | Output is correct |
19 | Correct | 5 ms | 492 KB | Output is correct |
20 | Correct | 5 ms | 492 KB | Output is correct |
21 | Correct | 6 ms | 492 KB | Output is correct |
22 | Correct | 5 ms | 492 KB | Output is correct |
23 | Correct | 5 ms | 492 KB | Output is correct |
24 | Correct | 6 ms | 492 KB | Output is correct |
25 | Correct | 11 ms | 620 KB | Output is correct |
26 | Correct | 17 ms | 620 KB | Output is correct |
27 | Correct | 28 ms | 748 KB | Output is correct |
28 | Correct | 39 ms | 748 KB | Output is correct |
29 | Correct | 36 ms | 804 KB | Output is correct |
30 | Correct | 35 ms | 748 KB | Output is correct |
31 | Correct | 36 ms | 748 KB | Output is correct |
32 | Correct | 35 ms | 876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 1 ms | 364 KB | Output is correct |
28 | Correct | 1 ms | 364 KB | Output is correct |
29 | Correct | 1 ms | 364 KB | Output is correct |
30 | Correct | 1 ms | 364 KB | Output is correct |
31 | Correct | 1 ms | 364 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 1 ms | 364 KB | Output is correct |
34 | Correct | 1 ms | 364 KB | Output is correct |
35 | Correct | 1 ms | 364 KB | Output is correct |
36 | Correct | 1 ms | 364 KB | Output is correct |
37 | Correct | 1 ms | 364 KB | Output is correct |
38 | Correct | 2 ms | 364 KB | Output is correct |
39 | Correct | 3 ms | 492 KB | Output is correct |
40 | Correct | 3 ms | 492 KB | Output is correct |
41 | Correct | 5 ms | 492 KB | Output is correct |
42 | Correct | 5 ms | 492 KB | Output is correct |
43 | Correct | 5 ms | 492 KB | Output is correct |
44 | Correct | 5 ms | 492 KB | Output is correct |
45 | Correct | 5 ms | 492 KB | Output is correct |
46 | Correct | 6 ms | 492 KB | Output is correct |
47 | Correct | 6 ms | 492 KB | Output is correct |
48 | Correct | 12 ms | 620 KB | Output is correct |
49 | Correct | 17 ms | 620 KB | Output is correct |
50 | Correct | 27 ms | 748 KB | Output is correct |
51 | Correct | 35 ms | 748 KB | Output is correct |
52 | Correct | 35 ms | 748 KB | Output is correct |
53 | Correct | 36 ms | 748 KB | Output is correct |
54 | Correct | 38 ms | 748 KB | Output is correct |
55 | Correct | 35 ms | 748 KB | Output is correct |
56 | Correct | 4 ms | 492 KB | Output is correct |
57 | Correct | 12 ms | 620 KB | Output is correct |
58 | Correct | 19 ms | 748 KB | Output is correct |
59 | Correct | 24 ms | 748 KB | Output is correct |
60 | Correct | 24 ms | 748 KB | Output is correct |
61 | Correct | 25 ms | 748 KB | Output is correct |
62 | Correct | 26 ms | 748 KB | Output is correct |
63 | Correct | 26 ms | 748 KB | Output is correct |
64 | Correct | 28 ms | 748 KB | Output is correct |
65 | Correct | 6 ms | 492 KB | Output is correct |
66 | Correct | 8 ms | 620 KB | Output is correct |
67 | Correct | 12 ms | 620 KB | Output is correct |
68 | Correct | 19 ms | 748 KB | Output is correct |
69 | Correct | 24 ms | 748 KB | Output is correct |
70 | Correct | 28 ms | 896 KB | Output is correct |
71 | Correct | 35 ms | 748 KB | Output is correct |
72 | Correct | 27 ms | 748 KB | Output is correct |
73 | Correct | 36 ms | 748 KB | Output is correct |
74 | Correct | 26 ms | 876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 380 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 3 ms | 492 KB | Output is correct |
27 | Correct | 4 ms | 492 KB | Output is correct |
28 | Correct | 5 ms | 508 KB | Output is correct |
29 | Correct | 6 ms | 492 KB | Output is correct |
30 | Correct | 5 ms | 492 KB | Output is correct |
31 | Correct | 5 ms | 492 KB | Output is correct |
32 | Correct | 5 ms | 492 KB | Output is correct |
33 | Correct | 5 ms | 492 KB | Output is correct |
34 | Correct | 5 ms | 492 KB | Output is correct |
35 | Correct | 10 ms | 620 KB | Output is correct |
36 | Correct | 17 ms | 620 KB | Output is correct |
37 | Correct | 27 ms | 748 KB | Output is correct |
38 | Correct | 36 ms | 876 KB | Output is correct |
39 | Correct | 35 ms | 748 KB | Output is correct |
40 | Correct | 36 ms | 748 KB | Output is correct |
41 | Correct | 36 ms | 748 KB | Output is correct |
42 | Correct | 36 ms | 748 KB | Output is correct |
43 | Correct | 4 ms | 492 KB | Output is correct |
44 | Correct | 12 ms | 620 KB | Output is correct |
45 | Correct | 18 ms | 748 KB | Output is correct |
46 | Correct | 24 ms | 748 KB | Output is correct |
47 | Correct | 23 ms | 748 KB | Output is correct |
48 | Correct | 25 ms | 804 KB | Output is correct |
49 | Correct | 26 ms | 748 KB | Output is correct |
50 | Correct | 34 ms | 748 KB | Output is correct |
51 | Runtime error | 2 ms | 492 KB | Execution killed with signal 6 |
52 | Halted | 0 ms | 0 KB | - |