#include "biscuits.h"
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define vll vector<ll>
#define pll pair<ll, ll>
#define pb push_back
typedef long long ll;
long long count_tastiness(long long x, vector<long long> a) {
ll k=a.size();
ll sum=0;
vll pw(k);
pw[0]=1;
for(ll i=0;i<k;i++){
if(i!=0) pw[i]=pw[i-1]*2;
sum+=pw[i]*a[i];
}
ll ans=1;
vll add;
add.pb(0);
for(ll i=0;i<k;i++){
vll new_add;
for(auto &it:add){
ll tep=it+a[i];
new_add.pb(tep/2);
if(tep>=x){
ans++;
tep-=x;
new_add.pb(tep/2);
}
}
add=new_add;
}
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... |