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;
using ll = long long;
ll count_tastiness(ll x, vector<ll> a) {
int k = a.size();
map<pair<int, ll>, ll> memo;
function<ll(int, ll)> f = [&] (int i, ll y) {
if(i < 0) return (ll)(y == 0);
if(memo.count({i, y})) return memo[{i, y}];
y = y - a[i] * (1LL << i);
memo[{i, y}] = f(i - 1, max(0ll, y)) + f(i - 1, max(0ll, y + x * (1LL << i)));
return memo[{i, y}];
};
return f(k - 1, 0);
}
# | 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... |