#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;
for(ll tar=1;tar*x<=sum;tar++){
bool good=1;
vll b=a;
for(ll rep=0;rep<x;rep++){
ll lef=tar;
for(ll i=k-1;i>=0;i--){
ll need=lef/pw[i];
if(b[i]>=need){
b[i]-=need;
lef-=pw[i]*need;
}
else{
lef-=pw[i]*b[i];
b[i]=0;
}
}
if(lef>0){
good=0;
break;
}
}
if(good){
ans++;
}
}
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... |