# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
867688 | TAhmed33 | Uplifting Excursion (BOI22_vault) | C++98 | 319 ms | 3720 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll bad = -1e17;
const ll MAXN = 1e5;
ll dp[2 * MAXN], dq[2 * MAXN], n, l;
bool ok (ll x) {
return x >= -MAXN && x < MAXN;
}
void chmax (ll &a, ll b) {
a = max(a, b);
}
void insert (ll a, ll b) {
for (ll i = -MAXN; i < MAXN; i++) dq[i + MAXN] = dp[i + MAXN];
for (ll i = -MAXN; i < MAXN; i++) {
if (ok(i - a * b)) chmax(dq[i + MAXN], b + dp[i - a * b + MAXN]);
}
if (ok(a * b)) chmax(dq[a * b + MAXN], b);
for (ll i = -MAXN; i < MAXN; i++) dp[i + MAXN] = dq[i + MAXN];
}
int main () {
cin >> n >> l;
for (auto &i : dp) i = bad;
for (ll i = -n; i <= n; i++) {
int x;
cin >> x;
int u = 0;
while ((1 << u) <= x) {
insert(i, (1 << u));
x -= (1 << u);
# | 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... |
# | 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... |