# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1091926 | onlk97 | Packing Biscuits (IOI20_biscuits) | C++14 | 2 ms | 348 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;
map <long long,long long> dp;
vector <long long> ps;
long long X;
long long calc(long long u){
if (u<=0) return 0;
if (dp.find(u)!=dp.end()) return dp[u];
long long g=__lg(u-1);
return dp[u]=calc(1ll<<g)+calc(min(u,ps[g]/X+1)-(1ll<<g));
}
long long count_tastiness(long long x,vector <long long> a){
dp.clear();
dp[1]=1;
ps.clear();
ps.push_back(a[0]);
for (int i=1; i<a.size(); i++) ps.push_back(ps.back()+(a[i]<<i));
ps.push_back(ps.back()); ps.push_back(ps.back());
X=x;
return calc(ps.back()/x+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... |