Submission #867688

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8676882023-10-29 08:05:27TAhmed33Uplifting Excursion (BOI22_vault)C++98
5 / 100
319 ms3720 KiB
#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);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...