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<bits/stdc++.h>
#include "biscuits.h"
#define ll long long
using namespace std;
ll Xk;
ll dp[61] , Pr[61];
ll Q(ll w){
if(w < 0) return 0ll;
if(w == 0) return 1ll;
int j;
for(j = 60; ~j; --j) if((1ll<<j) <= w) break;
/// return dp[j] + x;
return dp[j] + Q(min(w , Pr[j] / Xk) - (1ll<<j));
}
ll count_tastiness(ll X , vector<ll> a){
Xk = X;
a.resize(60);
for(int i = 0; i < 60; ++i){
Pr[i] = (1ll<<i) * a[i];
if(i) Pr[i] += Pr[i - 1];
}
dp[0]= 1ll;
for(int k = 1; k< 61; ++k) dp[k] = Q((1ll << k) - 1);
return dp[60];
}
# | 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... |