#include <bits/stdc++.h>
#include "biscuits.h"
using ll = long long;
using namespace std;
const int MAXN = 70;
ll a[MAXN], pot[MAXN];
int k;
ll bt(int pos, ll x){
if(a[pos] == 0) return 1;
ll ans = 0;
if(a[pos] >= x){
ll cnt = (a[pos] - x) / 2;
a[pos + 1] += cnt;
ans += bt(pos + 1, x);
a[pos + 1] -= cnt;
}
ll cnt = a[pos] / 2;
a[pos + 1] += cnt;
ans += bt(pos + 1, x);
a[pos + 1] -= cnt;
return ans;
}
ll count_tastiness(ll x, vector<ll> a_){
k = (int) a_.size();
for(int i=0; i<64; i++) a[i] = 0;
for(int i=0; i<k; i++) a[i] = a_[i];
return bt(0, x);
}
| # | 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... |