Submission #602940

# Submission time Handle Problem Language Result Execution time Memory
602940 2022-07-23T12:57:37 Z BT21tata Bali Sculptures (APIO15_sculpture) C++17
71 / 100
1000 ms 31884 KB
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define setp fixed<<setprecision
#define OK cerr<<"OK"<<endl<<flush
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define y0 jahdakdh
#define y1 jahsadakdakdh
#define endl '\n'
const ll MOD=1e9+7;
const ll mod=(1ll<<31)-1;
const ld eps=1e-8;
using namespace std;
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());

ll n, a, b, dp[2005][2005], pr[2005], ans;

int main()
{
    SPEED;
    cin>>n>>a>>b;
    for(int i=1; i<=n; i++)
    {
        ll x;
        cin>>x;
        pr[i]=pr[i-1]+x;
    }
    ans=(1ll<<43)-1;
    for(int bt=42; bt>=0; bt--)
    {
        memset(dp, 0, sizeof(dp));
        dp[0][0]=1;
        ans^=(1ll<<bt);
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=n; j++)
            {
                for(int k=0; k<i; k++)
                {
                    if(((pr[i]-pr[k])|ans)==ans and dp[k][j-1])
                        dp[i][j]=1;
                }
            }
        }
        bool f=0;
        for(int i=a; i<=b; i++)
            f|=dp[n][i];
        if(!f) ans^=(1ll<<bt);
    }
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 151 ms 31700 KB Output is correct
2 Correct 147 ms 31776 KB Output is correct
3 Correct 155 ms 31772 KB Output is correct
4 Correct 160 ms 31776 KB Output is correct
5 Correct 147 ms 31672 KB Output is correct
6 Correct 152 ms 31780 KB Output is correct
7 Correct 154 ms 31700 KB Output is correct
8 Correct 152 ms 31780 KB Output is correct
9 Correct 155 ms 31776 KB Output is correct
10 Correct 157 ms 31884 KB Output is correct
11 Correct 149 ms 31776 KB Output is correct
12 Correct 150 ms 31780 KB Output is correct
13 Correct 148 ms 31696 KB Output is correct
14 Correct 163 ms 31780 KB Output is correct
15 Correct 156 ms 31780 KB Output is correct
16 Correct 149 ms 31776 KB Output is correct
17 Correct 160 ms 31776 KB Output is correct
18 Correct 149 ms 31820 KB Output is correct
19 Correct 152 ms 31772 KB Output is correct
20 Correct 158 ms 31780 KB Output is correct
21 Correct 157 ms 31776 KB Output is correct
22 Correct 168 ms 31700 KB Output is correct
23 Correct 149 ms 31780 KB Output is correct
24 Correct 164 ms 31776 KB Output is correct
25 Correct 154 ms 31820 KB Output is correct
26 Correct 155 ms 31776 KB Output is correct
27 Correct 156 ms 31780 KB Output is correct
28 Correct 154 ms 31776 KB Output is correct
29 Correct 155 ms 31784 KB Output is correct
30 Correct 154 ms 31780 KB Output is correct
31 Correct 154 ms 31696 KB Output is correct
32 Correct 159 ms 31780 KB Output is correct
33 Correct 155 ms 31776 KB Output is correct
34 Correct 157 ms 31780 KB Output is correct
35 Correct 147 ms 31780 KB Output is correct
36 Correct 149 ms 31820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 158 ms 31700 KB Output is correct
2 Correct 159 ms 31780 KB Output is correct
3 Correct 150 ms 31792 KB Output is correct
4 Correct 156 ms 31700 KB Output is correct
5 Correct 170 ms 31776 KB Output is correct
6 Correct 149 ms 31700 KB Output is correct
7 Correct 149 ms 31780 KB Output is correct
8 Correct 158 ms 31792 KB Output is correct
9 Correct 155 ms 31700 KB Output is correct
10 Correct 151 ms 31784 KB Output is correct
11 Correct 156 ms 31780 KB Output is correct
12 Correct 149 ms 31780 KB Output is correct
13 Correct 147 ms 31820 KB Output is correct
14 Correct 160 ms 31780 KB Output is correct
15 Correct 162 ms 31796 KB Output is correct
16 Correct 162 ms 31776 KB Output is correct
17 Correct 155 ms 31780 KB Output is correct
18 Correct 162 ms 31696 KB Output is correct
19 Correct 149 ms 31688 KB Output is correct
20 Correct 151 ms 31780 KB Output is correct
21 Correct 162 ms 31820 KB Output is correct
22 Correct 159 ms 31716 KB Output is correct
23 Correct 149 ms 31788 KB Output is correct
24 Correct 152 ms 31776 KB Output is correct
25 Correct 157 ms 31784 KB Output is correct
26 Correct 156 ms 31788 KB Output is correct
27 Correct 155 ms 31788 KB Output is correct
28 Correct 174 ms 31780 KB Output is correct
29 Correct 155 ms 31780 KB Output is correct
30 Correct 150 ms 31776 KB Output is correct
31 Correct 161 ms 31780 KB Output is correct
32 Correct 157 ms 31776 KB Output is correct
33 Correct 149 ms 31780 KB Output is correct
34 Correct 152 ms 31776 KB Output is correct
35 Correct 173 ms 31700 KB Output is correct
36 Correct 153 ms 31700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 162 ms 31772 KB Output is correct
2 Correct 144 ms 31780 KB Output is correct
3 Correct 174 ms 31812 KB Output is correct
4 Correct 146 ms 31700 KB Output is correct
5 Correct 150 ms 31780 KB Output is correct
6 Correct 175 ms 31784 KB Output is correct
7 Correct 161 ms 31776 KB Output is correct
8 Correct 147 ms 31776 KB Output is correct
9 Correct 147 ms 31776 KB Output is correct
10 Correct 161 ms 31700 KB Output is correct
11 Correct 155 ms 31780 KB Output is correct
12 Correct 148 ms 31780 KB Output is correct
13 Correct 148 ms 31776 KB Output is correct
14 Correct 171 ms 31780 KB Output is correct
15 Correct 150 ms 31700 KB Output is correct
16 Correct 154 ms 31784 KB Output is correct
17 Correct 169 ms 31780 KB Output is correct
18 Correct 155 ms 31700 KB Output is correct
19 Correct 148 ms 31700 KB Output is correct
20 Correct 155 ms 31772 KB Output is correct
21 Correct 158 ms 31780 KB Output is correct
22 Correct 154 ms 31700 KB Output is correct
23 Correct 148 ms 31784 KB Output is correct
24 Correct 154 ms 31784 KB Output is correct
25 Correct 159 ms 31776 KB Output is correct
26 Correct 158 ms 31696 KB Output is correct
27 Correct 160 ms 31756 KB Output is correct
28 Correct 183 ms 31776 KB Output is correct
29 Correct 174 ms 31776 KB Output is correct
30 Correct 187 ms 31780 KB Output is correct
31 Correct 194 ms 31776 KB Output is correct
32 Correct 170 ms 31792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 154 ms 31776 KB Output is correct
2 Correct 150 ms 31784 KB Output is correct
3 Correct 146 ms 31724 KB Output is correct
4 Correct 150 ms 31776 KB Output is correct
5 Correct 153 ms 31776 KB Output is correct
6 Correct 151 ms 31784 KB Output is correct
7 Correct 156 ms 31820 KB Output is correct
8 Correct 155 ms 31780 KB Output is correct
9 Correct 157 ms 31700 KB Output is correct
10 Correct 156 ms 31780 KB Output is correct
11 Correct 166 ms 31780 KB Output is correct
12 Correct 150 ms 31780 KB Output is correct
13 Correct 156 ms 31720 KB Output is correct
14 Correct 158 ms 31776 KB Output is correct
15 Correct 149 ms 31776 KB Output is correct
16 Correct 167 ms 31776 KB Output is correct
17 Correct 153 ms 31804 KB Output is correct
18 Correct 165 ms 31700 KB Output is correct
19 Correct 147 ms 31692 KB Output is correct
20 Correct 150 ms 31776 KB Output is correct
21 Correct 149 ms 31776 KB Output is correct
22 Correct 146 ms 31784 KB Output is correct
23 Correct 158 ms 31780 KB Output is correct
24 Correct 150 ms 31700 KB Output is correct
25 Correct 148 ms 31780 KB Output is correct
26 Correct 148 ms 31776 KB Output is correct
27 Correct 154 ms 31700 KB Output is correct
28 Correct 148 ms 31788 KB Output is correct
29 Correct 157 ms 31700 KB Output is correct
30 Correct 149 ms 31780 KB Output is correct
31 Correct 147 ms 31776 KB Output is correct
32 Correct 153 ms 31780 KB Output is correct
33 Correct 152 ms 31784 KB Output is correct
34 Correct 158 ms 31796 KB Output is correct
35 Correct 149 ms 31784 KB Output is correct
36 Correct 152 ms 31776 KB Output is correct
37 Correct 162 ms 31780 KB Output is correct
38 Correct 151 ms 31776 KB Output is correct
39 Correct 162 ms 31788 KB Output is correct
40 Correct 158 ms 31780 KB Output is correct
41 Correct 151 ms 31712 KB Output is correct
42 Correct 152 ms 31780 KB Output is correct
43 Correct 173 ms 31776 KB Output is correct
44 Correct 156 ms 31788 KB Output is correct
45 Correct 150 ms 31780 KB Output is correct
46 Correct 155 ms 31796 KB Output is correct
47 Correct 165 ms 31780 KB Output is correct
48 Correct 153 ms 31792 KB Output is correct
49 Correct 157 ms 31792 KB Output is correct
50 Correct 171 ms 31784 KB Output is correct
51 Correct 175 ms 31780 KB Output is correct
52 Correct 169 ms 31780 KB Output is correct
53 Correct 169 ms 31780 KB Output is correct
54 Correct 183 ms 31776 KB Output is correct
55 Correct 176 ms 31700 KB Output is correct
56 Correct 150 ms 31780 KB Output is correct
57 Correct 161 ms 31796 KB Output is correct
58 Correct 164 ms 31780 KB Output is correct
59 Correct 169 ms 31776 KB Output is correct
60 Correct 167 ms 31788 KB Output is correct
61 Correct 191 ms 31780 KB Output is correct
62 Correct 167 ms 31780 KB Output is correct
63 Correct 166 ms 31780 KB Output is correct
64 Correct 164 ms 31700 KB Output is correct
65 Correct 165 ms 31780 KB Output is correct
66 Correct 159 ms 31788 KB Output is correct
67 Correct 169 ms 31772 KB Output is correct
68 Correct 170 ms 31776 KB Output is correct
69 Correct 166 ms 31780 KB Output is correct
70 Correct 171 ms 31784 KB Output is correct
71 Correct 176 ms 31792 KB Output is correct
72 Correct 184 ms 31820 KB Output is correct
73 Correct 170 ms 31796 KB Output is correct
74 Correct 184 ms 31784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 153 ms 31772 KB Output is correct
2 Correct 144 ms 31776 KB Output is correct
3 Correct 150 ms 31776 KB Output is correct
4 Correct 156 ms 31776 KB Output is correct
5 Correct 146 ms 31700 KB Output is correct
6 Correct 146 ms 31780 KB Output is correct
7 Correct 153 ms 31780 KB Output is correct
8 Correct 150 ms 31780 KB Output is correct
9 Correct 150 ms 31780 KB Output is correct
10 Correct 161 ms 31792 KB Output is correct
11 Correct 163 ms 31776 KB Output is correct
12 Correct 168 ms 31780 KB Output is correct
13 Correct 148 ms 31780 KB Output is correct
14 Correct 154 ms 31824 KB Output is correct
15 Correct 149 ms 31788 KB Output is correct
16 Correct 148 ms 31700 KB Output is correct
17 Correct 168 ms 31696 KB Output is correct
18 Correct 171 ms 31796 KB Output is correct
19 Correct 153 ms 31700 KB Output is correct
20 Correct 153 ms 31700 KB Output is correct
21 Correct 151 ms 31776 KB Output is correct
22 Correct 151 ms 31776 KB Output is correct
23 Correct 154 ms 31776 KB Output is correct
24 Correct 154 ms 31780 KB Output is correct
25 Correct 149 ms 31780 KB Output is correct
26 Correct 149 ms 31792 KB Output is correct
27 Correct 166 ms 31780 KB Output is correct
28 Correct 151 ms 31784 KB Output is correct
29 Correct 152 ms 31700 KB Output is correct
30 Correct 147 ms 31700 KB Output is correct
31 Correct 159 ms 31784 KB Output is correct
32 Correct 160 ms 31780 KB Output is correct
33 Correct 169 ms 31784 KB Output is correct
34 Correct 157 ms 31700 KB Output is correct
35 Correct 168 ms 31784 KB Output is correct
36 Correct 166 ms 31780 KB Output is correct
37 Correct 169 ms 31780 KB Output is correct
38 Correct 188 ms 31780 KB Output is correct
39 Correct 167 ms 31776 KB Output is correct
40 Correct 175 ms 31776 KB Output is correct
41 Correct 189 ms 31748 KB Output is correct
42 Correct 191 ms 31780 KB Output is correct
43 Correct 155 ms 31756 KB Output is correct
44 Correct 168 ms 31780 KB Output is correct
45 Correct 168 ms 31788 KB Output is correct
46 Correct 163 ms 31776 KB Output is correct
47 Correct 170 ms 31876 KB Output is correct
48 Correct 170 ms 31700 KB Output is correct
49 Correct 177 ms 31780 KB Output is correct
50 Correct 196 ms 31776 KB Output is correct
51 Correct 187 ms 31780 KB Output is correct
52 Execution timed out 1077 ms 31784 KB Time limit exceeded
53 Halted 0 ms 0 KB -