제출 #160140

#제출 시각아이디문제언어결과실행 시간메모리
160140BlueDiamondBali Sculptures (APIO15_sculpture)C++14
9 / 100
86 ms504 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll subtask1(int n, int l, int r) { ll ans = (1LL << 60); vector <int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int mask = 1; mask < (1 << n); mask += 2) { int bits = 0, aux = mask; while (aux) { bits++; aux -= aux & (-aux); } if (l <= bits && bits <= r) { ll curs = 0, cur = 0; for (int i = 0; i < n; i++) { if (mask & (1 << i)) { cur |= curs; curs = 0; } curs += a[i]; } cur |= curs; ans = min(ans, cur); } } return ans; } int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); /// freopen ("input", "r", stdin); int n, l, r; cin >> n >> l >> r; if (n <= 20) { cout << subtask1(n, l, r) << "\n"; return 0; } 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...