Submission #528814

#TimeUsernameProblemLanguageResultExecution timeMemory
528814radalBali Sculptures (APIO15_sculpture)C++14
100 / 100
276 ms448 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3") //#pragma GCC target("avx2,fma") #define rep(i,l,r) for (int i = l; i < r; i++) #define repr(i,r,l) for (int i = r; i >= l; i--) #define X first #define Y second #define pb push_back #define endl '\n' #define debug(x) cerr << #x << " : " << x << endl; using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pll; const long long int N = 2e3+20,mod = 1e9+7,inf = 1e18+10,sq = 300,maxm= 700+2; inline int mkay(int a,int b){ if (a+b >= mod) return a+b-mod; if (a+b < 0) return a+b+mod; return a+b; } inline int poww(int a,int k){ int z = 1; while (k){ if (k&1) z = 1ll*z*a%mod; a = 1ll*a*a%mod; k >>= 1; } return z; } int dp[N][2],a[N]; int main(){ ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,x,y; cin >> n >> x >> y; rep(i,1,n+1){ cin >> a[i]; } ll ans = 0; repr(k,60,0){ ll cur = (1ll << k)+ans-1; rep(i,1,n+1){ dp[i][0] = 2*n; dp[i][1] = 0; ll s = 0; repr(j,i,1){ s += a[j]; if ((s&cur) == s){ dp[i][0] = min(dp[j-1][0]+1,dp[i][0]); dp[i][1] = max(dp[i][1],dp[j-1][1]+1); } } } if (dp[n][0] > y || dp[n][1] < x){ ans += (1ll << k); } } cout << ans; }
#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...