Submission #1133608

#TimeUsernameProblemLanguageResultExecution timeMemory
1133608alterioPacking Biscuits (IOI20_biscuits)C++20
9 / 100
1095 ms328 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; #define ll long long ll count_tastiness(ll x, vector<ll> a) { ll ans = 0, sum = 0; int n = a.size(); for (ll i = 0; i < n; i++) sum += (1LL << i) * a[i]; for (ll y = 0; y <= sum / x; y++) { vector<ll> c = a; ll mx = 0; while ((1LL << (mx + 1)) <= y) mx++; ll ptr = mx; for (ll i = n - 1; i >= 0;) { while (ptr >= 0 && !(y & (1 << ptr))) ptr--; if (ptr < 0) break; i = min(i, ptr); ll diff = (ptr - i); diff = (1LL << diff); if (c[i] - x * diff >= 0) { ptr--; c[i] -= x * diff; continue; } else { if (i == 0) break; c[i - 1] += 2 * c[i]; i--; } } if (ptr < 0) ans++; } return ans; }
#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...