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;
map<long long,long long> memo[65];
long long dp(long long n, long long x) {
if (x == 0) return 1;
if (memo[n].find(x) != memo[n].end()) return memo[n][x];
long long ans = dp(n+1,A[n+1]+x/2);
if (x != 0) ans += dp(n+1,A[n+1]+(x-1)/2);
return memo[n][x] = ans;
}
long long count_tastiness(long long x, vector<long long> a) {
while (a.size() < 65) a.push_back(0);
A = a;
for (long long i = 0; i < 65; ++i) memo[i].clear();
return dp(0,A[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... |