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;
typedef long long ll;
vector<ll>a;
map<pair<ll,ll>,bool>b;
map<pair<ll,ll>,ll>mp;
ll x,n=61;
ll best(ll d,ll k)
{
if(d==n)
return 1;
pair<ll,ll>id={d,k};
if(b[id])
return mp[id];
b[id]=1;
ll &r=mp[id];
k+=a[d];
r=best(d+1,k/2);
if(k>=x)
r+=best(d+1,(k-x)/2);
}
long long count_tastiness(ll X, vector<ll> A)
{
x=X,a=A,a.resize(n);
b.clear(),mp.clear();
return best(0,0);
}
Compilation message (stderr)
biscuits.cpp: In function 'll best(ll, ll)':
biscuits.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
22 | }
| ^
# | 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... |