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;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define X first
#define Y second
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define SZ(a) ((int)a.size())
vector<ll> arr;
ll ans,X;
void dfs(int u,ll hv)
{
    if(u==SZ(arr))
        return ++ans,void();
    hv+=arr[u],dfs(u+1,hv/2);
    if(hv>=X)
        dfs(u+1,(hv-X)/2);
}
ll count_tastiness(ll x, vector<ll> a)
{
    if(x==1)
    {
        ans=1;
        for(int i=0;i<SZ(a);++i)
            for(int j=i+1;j<SZ(a);++j)
                if(a[i]>=(1LL<<(j-i)))
                    a[i]+=(1LL<<(j-i))*a[j],a[j]=0;
        for(int i=0;i<SZ(a);++i)
            ans*=a[i]+1;
        return ans;
    }
    ans=0,X=x;
    arr.swap(a);
    dfs(0,0);
    return ans;
}
| # | 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... |