| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357466 | Desh03 | Bali Sculptures (APIO15_sculpture) | C++20 | 64 ms | 464 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
vector<long long> p(n + 1);
for (int i = 1; i <= n; i++) {
cin >> p[i];
p[i] += p[i - 1];
}
long long ans = (1LL << 45) - 1;
if (a == 1) {
for (int i = 44; i >= 0; i--) {
ans ^= (1LL << i);
vector<int> dp(n + 1, n + 1);
dp[0] = 0;
for (int j = 1; j <= n; j++) {
for (int k = 0; k < j; k++) {
if (((p[j] - p[k]) & ans) == p[j] - p[k]) {
dp[j] = min(dp[j], dp[k] + 1);
}
}
}
if (dp[n] > b) {
ans ^= (1LL << i);
}
}
} else {
for (int i = 44; i >= 0; i--) {
ans ^= (1LL << i);
vector dp(n + 1, vector<bool> (n + 1));
dp[0][0] = 1;
for (int j = 1; j <= n; j++) {
for (int t = 1; t <= j; t++) {
for (int k = 0; k < j; k++) {
if (((p[j] - p[k]) & ans) == p[j] - p[k] && dp[k][t - 1]) {
dp[j][t] = 1;
break;
}
}
}
}
bool ok = 0;
for (int j = a; j <= b; j++) {
if (dp[n][j]) {
ok = 1;
break;
}
}
if (!ok) {
ans ^= (1LL << i);
}
}
}
cout << ans << '\n';
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
