# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590323 | ogibogi2004 | Packing Biscuits (IOI20_biscuits) | C++14 | 1191 ms | 2097152 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 "biscuits.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
unordered_map<ll,ll>dp;
ll s[64];
ll xx;
ll calc(ll n)
{
if(dp.count(n))return dp[n];
int t=0,pw2=1;
while(pw2<n){pw2*=2;t++;}
pw2/=2;t--;
return dp[n]=calc(pw2)+calc(min(n,1+s[t]/xx)-pw2);
}
long long count_tastiness(long long x, vector<long long> a) {
dp.clear();
s[0]=a[0];xx=x;
for(int i=1;i<a.size();i++)
{
s[i]=s[i-1]+a[i];
}
for(int i=0;i<=a.size();i++)
{
calc((1ll<<i));
}
return dp[(1ll<<a.size())];
}
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... |