Submission #1023340

# Submission time Handle Problem Language Result Execution time Memory
1023340 2024-07-14T16:30:15 Z MarwenElarbi Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#define ll long long
#define fi first
#define se second
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int nax=5e5+5;
signed main(){
    iostream::sync_with_stdio(false);
    int n,a,b;
    cin>>n>>a>>b;
    ll tab[n+1];
    tab[0]=0;
    for (int i = 1; i <= n; ++i)
    {
        cin>>tab[i];
    }
    long long sum=(1LL<<41)-1;
    for (int k = 40; k >= 0; --k)
    {
        sum^=(1LL<<k);
        int L[n+1];
        int R[n+1];
        L[0]=R[0]=0;
        for (int i = 1; i <= n; ++i)
        {
            long long cur=0;
            L[i]=1e9;R[i]=-1e9;
            for (int j = i; j > 0; j--)
            {
                cur+=tab[j];
                if((sum&cur)==cur){
                    R[i]=max(R[i],R[j-1]+1);
                    L[i]=min(L[i],L[j-1]+1);
                }
            }
        }
        cout <<L[n]<<" "<<R[n]<<endl;
        if(!(R[n]>=a&&L[n]<=b)) sum^=(1LL<<k);
    }
    cout <<sum<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -