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 namespace std;
using ll = long long;
using mp = map<pair<int, ll>, ll>;
vector<ll> A(200, 0);
ll calc(int current_bit, ll val, mp& dp){
if(current_bit == 63) return 1;
if(dp.find({current_bit, val}) != dp.end())
return dp[{current_bit, val}];
if(val == 0) return dp[{current_bit, val}] = calc(current_bit+1, A[current_bit+1], dp);
return dp[{current_bit, val}] = calc(current_bit+1, A[current_bit+1] + val/2, dp) +
calc(current_bit+1, A[current_bit+1] + (val-1)/2, dp);
}
ll count_tastiness(ll x, vector<ll> a) {
mp dp;
for(int i=0; i<(int)a.size(); i++) A[i] = a[i];
return calc(0, A[0], dp);
}
# | 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... |