# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
304613 | medmdg | 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>
#include "biscuits.h"
using namespace std;
long long int count_tastiness(long long int x,long long int[] a){
long long int b[61];
int k=61;
bool an[k];
memset(b,0,61);
for(int i=0;i<a.size();i++)
b[i]=a[i];
memset(an,false,k);
for(int i=0;i<61;i++){
if(b[i]>=x){
an[i]=true;
b[i]-=x;
}else{
an[i]=false;
}
b[i+1]+=b[i]/2;
b[i]=0;
}
unsigned long long int ans=0;
for(int i=0;i<61;i++){
if(an[i])
ans+=1<<i;
}
return ans;
}