# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338319 | mayflyyh | Packing Biscuits (IOI20_biscuits) | C++14 | 0 ms | 0 KiB |
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<bits/stdc++.h>
#define ll long long
ll dp[70];
ll b[70];
ll count_tastiness(ll x, ll[] a){
int end=65;
for(int i=0;i<=end;++i)
if(a[i]) b[i]=a[i];
else b[i]=0;
for(int i=end;i+1;--i){
if(i==end){
dp[i]=1;
}
else{
for(int j=end;j>=i+1;--j){
ll min=0,max=(1<<end-i)-1;
ll ai=0;
for(int k=j-1;k>=i;--k){
ai=ai*2+b[i];
ll y_=0;
if(k>i){
y_=(ai/x+1)<<(k-i);
if(y_>min)
min=y_;
}
else{
y_=ai/x;
if(y_<max)
max=y_;
}
}
}
}
}
return dp[0];
}