Submission #1028527

#TimeUsernameProblemLanguageResultExecution timeMemory
1028527vjudge1Bali Sculptures (APIO15_sculpture)C++17
0 / 100
147 ms262144 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2005; int n, x, y; ll a[N]; vector<ll> dp[N][N]; int main(){ cin >> n >> x >> y; for (int i = 1; i <= n; i ++) cin >> a[i], a[i] += a[i - 1], dp[i][1] = {a[i]}; for (int j = 2; j <= n; j ++){ for (int i = j; i <= n; i ++){ for (int k = j - 1; k < i; k ++){ for (int val : dp[k][j - 1]){ dp[i][j].push_back(val | (a[i] - a[k])); } } } } ll ans = 1e18; for (int i = x; i <= y; i ++) ans = min(ans, *min_element(dp[n][i].begin(), dp[n][i].end())); cout << ans << 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...