| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357759 | Agageldi | Bali Sculptures (APIO15_sculpture) | C++17 | 1096 ms | 464 KiB |
#include <bits/stdc++.h>
using namespace std;
#define N 500005
#define ll long long
const int inf = INT_MAX;
const int M = 998244353;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll n, a[N], B, A, b[N], ans = -1;
void solve(int x) {
if(x == n) {
ll cnt = 0, sm = 0, vl = 0;
for(int i = 1; i <= n; i++) {
sm += a[i];
if(b[i]) {
vl |= sm;
sm = 0;
cnt++;
}
}
if(cnt > B || cnt < A) return;
if(ans == -1) ans = vl;
ans = min(ans, vl);
return;
}
b[x] = 1;
solve(x + 1);
b[x] = 0;
solve(x + 1);
}
signed main() {
ios::sync_with_stdio(0);cin.tie(0);
cin >> n >> A >> B;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
b[n] = 1;
solve(1);
cout << ans << '\n';
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
