Submission #582526

#TimeUsernameProblemLanguageResultExecution timeMemory
582526gg123_peBali Sculptures (APIO15_sculpture)C++14
71 / 100
11 ms316 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> ii; #define f(i,a,b) for(int i = a; i < b; i++) #define fa(i,a,b) for(int i = a; i >= b; i--) const int N = 2005; const ll inf = 1e9; int n, A, B; bool dp[105][105]; ll a[2005]; int main(){ cin >> n >> A >> B; f(i,1,n+1) cin >> a[i]; if(n <= 100){ ll ans = (1LL<<37) - 1; fa(ij,36,0){ ans ^= (1LL<<ij); f(i,1,n+1) f(j,1,i+1) dp[i][j] = 0; dp[0][0] = 1; f(i,1,n+1){ ll s = 0; fa(j,i,1){ s += a[j]; if((s|ans) != ans) continue; f(k,1,i+1) if(dp[j-1][k-1]) dp[i][k] = 1; } } bool fe = 0; f(j,A,B+1) fe |= dp[n][j]; if(!fe) ans ^= (1LL<<ij); } cout << ans << "\n"; } return 0; }
#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...