| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1283933 | farica | 비스킷 담기 (IOI20_biscuits) | C++20 | 0 ms | 0 KiB | 
#include "biscuits.h"
#include <bits/stdc++.h>
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;
}
