Submission #602938

# Submission time Handle Problem Language Result Execution time Memory
602938 2022-07-23T12:56:34 Z BT21tata Bali Sculptures (APIO15_sculpture) C++17
0 / 100
164 ms 31788 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^=(1<<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^=(1<<bt);
    }
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 155 ms 31780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 31788 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 153 ms 31784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 156 ms 31780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 154 ms 31780 KB Output isn't correct
2 Halted 0 ms 0 KB -