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 <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
typedef long long ll;
ll count_tastiness(ll x,vector<ll> a)
{
const int L=60;
while(a.size()<L) a.push_back(0);
vector<ll> s(L,0);
for(int i=0;i<L;i++) s[i]=(i>0?s[i-1]:0)+a[i]*(ll(1)<<i);
map<ll,ll> dp;
dp[0]=1;
function<ll(ll)> g=[&](ll n)->ll
{
if(n<0) return 0;
if(dp.find(n)!=dp.end()) return dp[n];
int i=63-__builtin_clzll(n);
return (dp[n]=g((ll(1)<<i)-1)+g(min(n-(ll(1)<<i),(s[i]/x-(ll(1)<<i)))));
};
return g(s[L-1]);
}
# | 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... |