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;
vector<long long> a;
long long x;
map<long long, long long> dp[60];
long long calc (int i = 0, long long hv = 0) {
if (i == 60) {
return 1;
}
hv = (hv / 2) + a[i];
if (dp[i].count(hv)) {
return dp[i][hv];
}
long long ret = calc(i + 1, hv);
if (hv >= x) {
ret += calc(i + 1, hv - x);
}
return dp[i][hv] = ret;
}
long long count_tastiness(long long x, vector<long long> t) {
::a = t;
::x = x;
for (int i = 0; i < 60; ++i) {
dp[i].clear();
}
while (a.size() < 60) {
a.push_back(0);
}
return calc();
}
# | 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... |