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 <map>
using ll = long long;
const int MX = 200;
ll x;
std::map<ll, ll> map[MX];
std::vector<ll> a;
ll dfs(int d, ll v)
{
if(d<(int)a.size()) v+=a[d];
if(d>=(int)a.size() && v==0) return 1;
auto it=map[d].find(v);
if(it != map[d].end()) return it->second;
ll ans = dfs(d+1, v/2);
if(v>=x) ans += dfs(d+1, (v-x)/2);
return ans;
}
long long count_tastiness(long long _x, std::vector<long long> _a)
{
x=_x;
a=_a;
return dfs(0, 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... |