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;
const int k = 60;
ll count_tastiness(ll x, vector<ll> a) {
a.resize(k);
vector<ll> dp(k+1, 1);
ll sum = 0;
for(int i = 1; i <= k; i++){
sum += a[i-1]*(1ll<<(i-1));
ll s = sum;
ll sub = 0;
for(int j = i-1; j >= 0; j--){
if((s-sub)/x >= (1ll<<j)){
dp[i] += dp[j];
sub += x*(1ll<<j);
}
ll v = a[j]*(1ll<<j);
sub = max(0ll, sub-v);
s -= v;
}
}
return dp[k];
}
# | 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... |