# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
303730 | denkendoemeer | Packing Biscuits (IOI20_biscuits) | C++14 | 191 ms | 940 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
using namespace std;
map<ll,ll>dp;
ll calc(ll num)
{
ll u=0;
while(num)
{
num=num/2;
u++;
}
return u-1;
}
ll divide(ll x,vector<ll>a,ll lim)
{
if (dp.find(lim)!=dp.end())
return dp[lim];
if (lim<=0)
return 0;
if (lim==1)
return dp[lim]=1;
ll nr=calc(lim-1);
return dp[lim]=divide(x,a,1LL<<nr)+divide(x,a,min(lim,1+a[nr]/x)-(1LL<<nr));
}
ll count_tastiness(ll x,vector<ll>a)
{
dp.clear();
int i;
for(i=1;i<a.size();i++)
a[i]=a[i-1]+(a[i]<<i);
while(a.size()<=64)
a.push_back(a.back());
return divide(x,a,1+a.back());
}
Compilation message (stderr)
# | 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... |