#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17;
typedef long long ll;
const ll MOD = (ll)1e9+7;
#define P pair
#define S second
#define F first
#define pb push_back
#define V vector
#define all(v) v.begin(), v.end()
long long count_tastiness(long long x, std::vector<long long> a) {
ll k=(ll)a.size();
V<ll>b(62,0);
for (int i=1;i<=k;i++) {
b[i]=a[i-1];
}
for (int i=1;i<=60;i++) {
ll c=(b[i]-1)/2;
b[i+1]+=c;
b[i]-=2*c;
}
ll dp[(int)61];
dp[0]=1LL;
for (int i=1;i<=60;i++) {
dp[i]=0LL;
dp[i]+=dp[i-1];
if (b[i]>=1) {
dp[i]+=dp[i-1];
continue;
}
for (int j=i-1;j>=1;j--) {
if (b[j]==2) {
dp[i]+=dp[j-1];
}
if (b[j]==0) {
break;
}
}
}
return dp[60];
}
# | 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... |