# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
366209 | dolphingarlic | Packing Biscuits (IOI20_biscuits) | C++14 | 78 ms | 1004 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 "biscuits.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll x, s[60];
map<ll, ll> dp;
ll solve(ll n) {
if (n <= 0) return 0;
if (dp.count(n)) return dp[n];
for (int i = 0; i < 60; i++) if ((1ll << i + 1) >= n)
return dp[n] = solve(1ll << i) + solve(min(n, 1 + s[i] / x) - (1ll << i));
}
ll count_tastiness(ll x, vector<ll> a) {
a.resize(60), ::x = x;
s[0] = a[0];
for (int i = 1; i < 60; i++) s[i] = s[i - 1] + (1ll << i) * a[i];
dp.clear();
dp[1] = 1;
return solve(1ll << 60);
}
Compilation message (stderr)
# | 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... |