# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
732954 | PoonYaPat | Packing Biscuits (IOI20_biscuits) | C++14 | 15 ms | 1192 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;
typedef long long ll;
ll qs[61],sum,bag;
ll find(ll x) {
if (x<0) return 0;
if (x==0) return 1;
if (x==1) return qs[0];
int k;
for (int i=59; i>0; --i) {
if ((1ll<<i)<=x) {
k=i;
break;
}
}
return qs[k-1]+find(min(x-(1ll<<k),sum/bag-(1ll<<k)));
}
ll count_tastiness(ll X, vector<ll> a) {
bag=X;
sum=a[0];
if (a[0]>=bag) qs[0]=2;
else qs[0]=1;
for (int i=1; i<60; ++i) {
if (i<a.size()) sum+=a[i]*(1ll<<i);
qs[i]=find((1ll<<(i+1))-1);
}
return qs[59];
}
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... |