Submission #32298

#TimeUsernameProblemLanguageResultExecution timeMemory
32298RezwanArefin01Bali Sculptures (APIO15_sculpture)C++14
0 / 100
0 ms33436 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; const int maxn = 2005; ll dp[maxn][maxn], sum[maxn]; int main(int argc, char const *argv[]) { #ifdef LOCAL_TESTING freopen("in", "r", stdin); #endif int n, a, b; cin >> n >> a >> b; for(int i = 1; i <= n; i++) { cin >> sum[i]; sum[i] += sum[i-1]; } for(int i = 0; i <= n; i++) dp[0][i] = sum[i]; for(int k = 1; k < b; k++) { for(int i = 1; i <= n; i++) { dp[k][i] = 1e18; for(int j = 0; j < i; j++) { dp[k][i] = min(dp[k][i], dp[k - 1][j] | (sum[i] - sum[j])); } } } ll Min = 1e18; for(int i = a-1; i < b; i++) Min = min(Min, dp[i][n]); cout << Min << 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...