Submission #328136

#TimeUsernameProblemLanguageResultExecution timeMemory
328136hivakaramiBali Sculptures (APIO15_sculpture)C++14
50 / 100
107 ms512 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double doublel; #define f first #define s second const int N = 3000 + 100; const int sq = 200; const ll mod = 1e9 + 7; const ll inf = 1e16; int dp[N]; ll y[N]; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); int n, a, b; cin >> n >> a >> b; for(int i = 0; i < n; i++) cin >> y[i]; ll ans = (1ll << 42)-1; //cout << ans << endl; for(int i = 41; i >= 0; i--) { ans ^= (1ll << i); //cout << ans << endl; for(int j = 0; j < n; j++) { dp[j] = b+1; ll sum = y[j]; for(int k = j-1; k >= 0; k--) { if((ans | sum) == ans) { dp[j] = min(dp[j], 1 + dp[k]); } sum += y[k]; } if((ans | sum) == ans) dp[j] = 1; } if(dp[n-1] > b) ans ^= (1ll << i); } cout << ans << endl; 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...