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>
using namespace std;
long long x, k;
vector<long long> a;
map<long long, long long> mp[60];
long long cnt(long long ind, long long s)
{
if (ind == 60) return 1;
if (mp[ind].count(s)) return mp[ind][s];
if (ind < k) s += a[ind];
long long res = 0;
res += cnt(ind + 1, s);
if (x <= s) res += cnt(ind + 1, (s - x) >> 1);
return mp[ind][s] = res;
}
long long count_tastiness(long long X, vector<long long> A)
{
for (int i = 0; i < 60; i++) mp[i].clear();
x = X, a = A, k = A.size();
return cnt(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... |