제출 #153048

#제출 시각아이디문제언어결과실행 시간메모리
153048dolphingarlicBali Sculptures (APIO15_sculpture)C++14
0 / 100
2 ms504 KiB
#include <bits/stdc++.h> #define FOR(i, x, y) for (int i = x; i < y; i++) typedef long long ll; using namespace std; ll s[2001], pref[2001], dp1[2001][2001], dp2[101][101]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, a, b; cin >> n >> a >> b; FOR(i, 1, n + 1) { cin >> s[i]; pref[i] = pref[i - 1] + s[i]; } // if (a == 1) { // } else { FOR(i, 1, n + 1) dp2[i][0] = INT_MAX; dp2[0][0] = 0; FOR(i, 1, n + 1) { FOR(j, 1, i + 1) { dp2[i][j] = INT_MAX; FOR(k, j - 1, i) { dp2[i][j] = min(dp2[i][j], dp2[k][j - 1] | (pref[i] - pref[k])); } } } ll ans = INT_MAX; FOR(i, a, b + 1) ans = min(ans, dp2[n][i]); cout << ans; // } 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...