#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
long long count_tastiness(long long x, std::vector<long long> a) {
int k = (int)a.size();
vector<ll>dp(60, 0);
ll ans = 0;
for(int i=0; i<60; ++i) {
int j = i;
if((1LL<<i) > INF/x) continue;
ll sum = x * (1LL<<i);
for(; j>=0; --j) {
sum -= a[j] * (1LL<<j);
if(sum <= 0) break;
}
if(j) dp[i] = dp[j-1];
else dp[i] = 1;
ans += dp[i];
}
return ans;
}
| # | 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... |