# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034691 | Marco_Escandon | Packing Biscuits (IOI20_biscuits) | C++17 | 100 ms | 8720 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<pair<ll,ll>,ll> mapa;
ll sol(ll i, ll j)
{
if(i==-1) return 1;
if(i<-1||j<(1ll<<i)) return 0;
if(mapa[{i,j}]!=0) return mapa[{i,j}];
ll h=-1;
if(j>(1LL<<i)) h=min((ll)(log2l(j-(1LL<<i))),i-1LL);
ll ac=sol(h,j-(1LL<<i));
for(int k=0; k<h; k++)
ac+=sol(k,temp[k]);
if(h!=-1)ac++;
return mapa[{i,j}]=ac;
}
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;
}
ll ac2=0;
for(int i=0; i<63; i++)
{
ac2+=sol(i,temp[i]);
}
return ac2+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... |