Submission #1023335

#TimeUsernameProblemLanguageResultExecution timeMemory
1023335MarwenElarbiBali Sculptures (APIO15_sculpture)C++17
37 / 100
1 ms464 KiB
#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); } } } if(!(R[n]>=a&&L[n]<=b)) sum^=(1<<k); } cout <<sum<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...