# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034879 | Marco_Escandon | Packing Biscuits (IOI20_biscuits) | C++17 | 59 ms | 1372 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;
typedef long long ll;
vector<ll> temp;
map<ll,ll> mapa;
ll sol(ll n)
{
if(n<=0) return 1;
if(n==1) return 2;
if(mapa[n]!=0) return mapa[n];
ll bs=0;
for(ll i=0; i<63; i++)
{
if((1LL<<i)<n&&n<=(1LL<<(i+1)))
{
bs=sol(1LL<<i)+sol(min(n,1+temp[i])-(1LL<<i))-2;
}
}
return mapa[n]=bs+1;
}
long long count_tastiness(long long x, std::vector<long long> a) {
a.resize(63);
temp=a;
ll ac=0;
for(int i=0; i<a.size(); i++)
{
ac+=(a[i]<<i);
temp[i]=ac/x;
}
mapa.clear();
return sol(2e18)-1;
}
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... |