| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1353542 | fauntleroy | Bali Sculptures (APIO15_sculpture) | C++20 | 1093 ms | 484 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n, A, B;
cin >> n >> A >> B;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<ll> pref(n + 1, 0);
pref[0] = 0;
for (int i = 1; i <= n; i++) {
pref[i] = pref[i - 1] + a[i - 1];
}
ll bad = 0;
for (int b = 41; b >= 0; b--) {
vector<vector<bool>> dp(n + 1, vector<bool>(B + 1, false));
dp[0][0] = true;
ll cand = bad | (1ll << b);
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= n; j++) {
ll s = pref[j] - pref[i];
if ((s & cand) == 0) {
for (int k = 1; k <= B; k++) {
if (dp[i][k - 1]) {
dp[j][k] = true;
}
}
}
}
}
bool ok = false;
for (int k = A; k <= B; k++) {
if (dp[n][k]) {
ok = true;
}
}
if (ok) {
bad = cand;
}
}
long long all = (1LL << 42) - 1;
cout << (all ^ bad) << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
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... | ||||
