Submission #735576

# Submission time Handle Problem Language Result Execution time Memory
735576 2023-05-04T10:50:46 Z bin9638 Bali Sculptures (APIO15_sculpture) C++17
71 / 100
1000 ms 32136 KB
#include <bits/stdc++.h>

using namespace std;

#define N 2010
#define ll long long
#define fs first
#define sc second
#define ii pair<ll,int>
#define pb push_back
#define int ll

int S,n,A,B,a[N],ans,dp[N][N];

void solve(int id)
{
    S+=(1ll<<id);
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=n;i++)
    {
        if((a[i]&S)==0)
            dp[i][1]=1;
        dp[i][1]+=dp[i-1][1];
    }
    for(int j=2;j<=B;j++)
    {
        for(int i=j;i<=n;i++)
        {
            for(int t=j-1;t<i;t++)
                if((S&(a[i]-a[t]))==0&&dp[t][j-1]>dp[t-1][j-1])
                {
                    dp[i][j]=1;
                    break;
                }
            dp[i][j]+=dp[i-1][j];
        }
    }
    for(int i=A;i<=B;i++)
        if(dp[n][i]>dp[n-1][i])
            return;
    ans+=(1ll<<id);
    S-=(1ll<<id);
}

int32_t main()
{
    #ifdef SKY
    freopen("A.inp","r",stdin);
    freopen("A.out","w",stdout);
    #endif // SKY
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>A>>B;
    for(int i=1;i<=n;i++)
        cin>>a[i],a[i]+=a[i-1];
    for(int i=40;i>=0;i--)
        solve(i);
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 152 ms 31828 KB Output is correct
2 Correct 143 ms 31932 KB Output is correct
3 Correct 141 ms 31816 KB Output is correct
4 Correct 144 ms 31932 KB Output is correct
5 Correct 146 ms 31932 KB Output is correct
6 Correct 137 ms 31828 KB Output is correct
7 Correct 141 ms 32136 KB Output is correct
8 Correct 142 ms 31932 KB Output is correct
9 Correct 151 ms 31932 KB Output is correct
10 Correct 147 ms 31952 KB Output is correct
11 Correct 141 ms 31956 KB Output is correct
12 Correct 143 ms 31956 KB Output is correct
13 Correct 148 ms 31928 KB Output is correct
14 Correct 142 ms 31932 KB Output is correct
15 Correct 143 ms 31940 KB Output is correct
16 Correct 142 ms 31940 KB Output is correct
17 Correct 146 ms 31932 KB Output is correct
18 Correct 144 ms 31932 KB Output is correct
19 Correct 159 ms 31932 KB Output is correct
20 Correct 137 ms 31932 KB Output is correct
21 Correct 141 ms 31932 KB Output is correct
22 Correct 148 ms 31928 KB Output is correct
23 Correct 151 ms 31940 KB Output is correct
24 Correct 144 ms 31948 KB Output is correct
25 Correct 143 ms 31952 KB Output is correct
26 Correct 148 ms 31928 KB Output is correct
27 Correct 144 ms 31940 KB Output is correct
28 Correct 141 ms 31932 KB Output is correct
29 Correct 143 ms 31828 KB Output is correct
30 Correct 149 ms 31932 KB Output is correct
31 Correct 139 ms 31828 KB Output is correct
32 Correct 136 ms 31928 KB Output is correct
33 Correct 139 ms 31936 KB Output is correct
34 Correct 148 ms 31944 KB Output is correct
35 Correct 147 ms 31932 KB Output is correct
36 Correct 149 ms 31932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 31952 KB Output is correct
2 Correct 149 ms 31828 KB Output is correct
3 Correct 145 ms 31928 KB Output is correct
4 Correct 139 ms 31828 KB Output is correct
5 Correct 147 ms 31944 KB Output is correct
6 Correct 150 ms 31928 KB Output is correct
7 Correct 155 ms 31932 KB Output is correct
8 Correct 143 ms 31928 KB Output is correct
9 Correct 146 ms 31932 KB Output is correct
10 Correct 147 ms 31932 KB Output is correct
11 Correct 140 ms 31936 KB Output is correct
12 Correct 147 ms 31936 KB Output is correct
13 Correct 166 ms 31948 KB Output is correct
14 Correct 141 ms 31932 KB Output is correct
15 Correct 140 ms 31932 KB Output is correct
16 Correct 139 ms 31936 KB Output is correct
17 Correct 151 ms 31828 KB Output is correct
18 Correct 152 ms 31828 KB Output is correct
19 Correct 148 ms 31928 KB Output is correct
20 Correct 147 ms 31828 KB Output is correct
21 Correct 139 ms 31932 KB Output is correct
22 Correct 145 ms 31828 KB Output is correct
23 Correct 155 ms 31932 KB Output is correct
24 Correct 141 ms 31932 KB Output is correct
25 Correct 137 ms 31828 KB Output is correct
26 Correct 142 ms 31932 KB Output is correct
27 Correct 139 ms 31860 KB Output is correct
28 Correct 151 ms 31828 KB Output is correct
29 Correct 144 ms 31828 KB Output is correct
30 Correct 145 ms 31932 KB Output is correct
31 Correct 153 ms 31928 KB Output is correct
32 Correct 165 ms 31940 KB Output is correct
33 Correct 154 ms 31828 KB Output is correct
34 Correct 149 ms 31936 KB Output is correct
35 Correct 153 ms 31928 KB Output is correct
36 Correct 153 ms 31928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 153 ms 31932 KB Output is correct
2 Correct 146 ms 31936 KB Output is correct
3 Correct 143 ms 31932 KB Output is correct
4 Correct 146 ms 31932 KB Output is correct
5 Correct 167 ms 31940 KB Output is correct
6 Correct 157 ms 31828 KB Output is correct
7 Correct 152 ms 31932 KB Output is correct
8 Correct 150 ms 31828 KB Output is correct
9 Correct 149 ms 31928 KB Output is correct
10 Correct 139 ms 31932 KB Output is correct
11 Correct 163 ms 31928 KB Output is correct
12 Correct 149 ms 31940 KB Output is correct
13 Correct 140 ms 31828 KB Output is correct
14 Correct 143 ms 31928 KB Output is correct
15 Correct 142 ms 31956 KB Output is correct
16 Correct 140 ms 31828 KB Output is correct
17 Correct 144 ms 31928 KB Output is correct
18 Correct 146 ms 31928 KB Output is correct
19 Correct 143 ms 31944 KB Output is correct
20 Correct 146 ms 31936 KB Output is correct
21 Correct 142 ms 31824 KB Output is correct
22 Correct 147 ms 31932 KB Output is correct
23 Correct 144 ms 31828 KB Output is correct
24 Correct 150 ms 31932 KB Output is correct
25 Correct 144 ms 31928 KB Output is correct
26 Correct 142 ms 31948 KB Output is correct
27 Correct 138 ms 31928 KB Output is correct
28 Correct 143 ms 31828 KB Output is correct
29 Correct 140 ms 31936 KB Output is correct
30 Correct 139 ms 31868 KB Output is correct
31 Correct 143 ms 31928 KB Output is correct
32 Correct 143 ms 31936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 139 ms 31932 KB Output is correct
2 Correct 147 ms 31948 KB Output is correct
3 Correct 156 ms 31936 KB Output is correct
4 Correct 142 ms 31936 KB Output is correct
5 Correct 141 ms 31828 KB Output is correct
6 Correct 150 ms 31936 KB Output is correct
7 Correct 137 ms 31940 KB Output is correct
8 Correct 141 ms 31928 KB Output is correct
9 Correct 146 ms 31932 KB Output is correct
10 Correct 149 ms 31932 KB Output is correct
11 Correct 137 ms 31828 KB Output is correct
12 Correct 158 ms 31948 KB Output is correct
13 Correct 142 ms 31956 KB Output is correct
14 Correct 148 ms 31936 KB Output is correct
15 Correct 142 ms 31932 KB Output is correct
16 Correct 153 ms 31928 KB Output is correct
17 Correct 140 ms 31928 KB Output is correct
18 Correct 146 ms 31928 KB Output is correct
19 Correct 140 ms 31828 KB Output is correct
20 Correct 138 ms 31932 KB Output is correct
21 Correct 150 ms 31836 KB Output is correct
22 Correct 155 ms 31932 KB Output is correct
23 Correct 138 ms 31928 KB Output is correct
24 Correct 144 ms 31936 KB Output is correct
25 Correct 148 ms 31948 KB Output is correct
26 Correct 147 ms 31936 KB Output is correct
27 Correct 147 ms 31828 KB Output is correct
28 Correct 149 ms 31928 KB Output is correct
29 Correct 142 ms 31944 KB Output is correct
30 Correct 141 ms 31848 KB Output is correct
31 Correct 138 ms 31948 KB Output is correct
32 Correct 144 ms 31928 KB Output is correct
33 Correct 142 ms 31932 KB Output is correct
34 Correct 146 ms 31936 KB Output is correct
35 Correct 142 ms 31940 KB Output is correct
36 Correct 145 ms 31940 KB Output is correct
37 Correct 162 ms 31924 KB Output is correct
38 Correct 141 ms 32024 KB Output is correct
39 Correct 144 ms 31936 KB Output is correct
40 Correct 143 ms 31936 KB Output is correct
41 Correct 141 ms 31828 KB Output is correct
42 Correct 143 ms 31936 KB Output is correct
43 Correct 162 ms 31908 KB Output is correct
44 Correct 146 ms 31932 KB Output is correct
45 Correct 143 ms 31940 KB Output is correct
46 Correct 145 ms 31828 KB Output is correct
47 Correct 137 ms 31940 KB Output is correct
48 Correct 142 ms 31944 KB Output is correct
49 Correct 144 ms 31952 KB Output is correct
50 Correct 146 ms 31820 KB Output is correct
51 Correct 144 ms 31932 KB Output is correct
52 Correct 147 ms 31948 KB Output is correct
53 Correct 138 ms 31828 KB Output is correct
54 Correct 140 ms 31936 KB Output is correct
55 Correct 161 ms 31896 KB Output is correct
56 Correct 143 ms 31936 KB Output is correct
57 Correct 155 ms 31828 KB Output is correct
58 Correct 143 ms 31940 KB Output is correct
59 Correct 147 ms 31932 KB Output is correct
60 Correct 159 ms 32024 KB Output is correct
61 Correct 140 ms 31828 KB Output is correct
62 Correct 148 ms 31880 KB Output is correct
63 Correct 155 ms 31932 KB Output is correct
64 Correct 143 ms 31932 KB Output is correct
65 Correct 142 ms 31932 KB Output is correct
66 Correct 145 ms 31936 KB Output is correct
67 Correct 143 ms 31952 KB Output is correct
68 Correct 151 ms 31928 KB Output is correct
69 Correct 149 ms 31932 KB Output is correct
70 Correct 145 ms 31828 KB Output is correct
71 Correct 143 ms 31828 KB Output is correct
72 Correct 165 ms 31928 KB Output is correct
73 Correct 144 ms 31928 KB Output is correct
74 Correct 146 ms 31828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 149 ms 31948 KB Output is correct
2 Correct 146 ms 31928 KB Output is correct
3 Correct 139 ms 31932 KB Output is correct
4 Correct 153 ms 31828 KB Output is correct
5 Correct 139 ms 31928 KB Output is correct
6 Correct 151 ms 31932 KB Output is correct
7 Correct 145 ms 31828 KB Output is correct
8 Correct 159 ms 31940 KB Output is correct
9 Correct 161 ms 31940 KB Output is correct
10 Correct 140 ms 31932 KB Output is correct
11 Correct 137 ms 31940 KB Output is correct
12 Correct 158 ms 31932 KB Output is correct
13 Correct 146 ms 31948 KB Output is correct
14 Correct 137 ms 31828 KB Output is correct
15 Correct 138 ms 31952 KB Output is correct
16 Correct 156 ms 31936 KB Output is correct
17 Correct 140 ms 31928 KB Output is correct
18 Correct 139 ms 31932 KB Output is correct
19 Correct 142 ms 31928 KB Output is correct
20 Correct 155 ms 31828 KB Output is correct
21 Correct 142 ms 31932 KB Output is correct
22 Correct 148 ms 31820 KB Output is correct
23 Correct 136 ms 31936 KB Output is correct
24 Correct 140 ms 31836 KB Output is correct
25 Correct 145 ms 31900 KB Output is correct
26 Correct 148 ms 31820 KB Output is correct
27 Correct 138 ms 31828 KB Output is correct
28 Correct 165 ms 31828 KB Output is correct
29 Correct 150 ms 31944 KB Output is correct
30 Correct 139 ms 31928 KB Output is correct
31 Correct 151 ms 31940 KB Output is correct
32 Correct 142 ms 31860 KB Output is correct
33 Correct 141 ms 31928 KB Output is correct
34 Correct 144 ms 31932 KB Output is correct
35 Correct 138 ms 31828 KB Output is correct
36 Correct 144 ms 31932 KB Output is correct
37 Correct 145 ms 31844 KB Output is correct
38 Correct 139 ms 31944 KB Output is correct
39 Correct 146 ms 31828 KB Output is correct
40 Correct 137 ms 31932 KB Output is correct
41 Correct 139 ms 31944 KB Output is correct
42 Correct 144 ms 31948 KB Output is correct
43 Correct 141 ms 31948 KB Output is correct
44 Correct 146 ms 31940 KB Output is correct
45 Correct 150 ms 31828 KB Output is correct
46 Correct 154 ms 31932 KB Output is correct
47 Correct 163 ms 31928 KB Output is correct
48 Correct 150 ms 31940 KB Output is correct
49 Correct 155 ms 31944 KB Output is correct
50 Correct 153 ms 31888 KB Output is correct
51 Correct 170 ms 31908 KB Output is correct
52 Correct 581 ms 31944 KB Output is correct
53 Execution timed out 1054 ms 31956 KB Time limit exceeded
54 Halted 0 ms 0 KB -