# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48154 | square1001 | Bali Sculptures (APIO15_sculpture) | C++14 | 601 ms | 1160 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bitset>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
vector<int> v(N);
for (int i = 0; i < N; i++) cin >> v[i];
long long ret = 0;
for (int i = 40; i >= 0; i--) {
vector<bitset<2001> > dp(N + 1);
dp[0] = 1;
for (int j = 1; j <= N; j++) {
long long cur = 0;
for (int k = j - 1; k >= 0; k--) {
cur += v[k];
if (((cur >> (i + 1)) | ret) == ret && !((cur >> i) & 1)) {
dp[j] |= dp[k] << 1;
}
}
}
bool ok = false;
for (int j = A; j <= B; j++) {
ok = ok || dp[N][j];
}
ret <<= 1;
if (!ok) ret++;
}
# | 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... |