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>
#define rep(i,n)for(int i=0;i<int(n);i++)
using namespace std;
typedef long long ll;
long long count_tastiness(long long x, std::vector<long long> a) {
//~ if(x==1){
a.resize(61);
vector<map<ll,ll>>dp(61);
dp[0][0]=1;
rep(i,60){
for(auto&p:dp[i]){
ll c=p.first+a[i];
//use
if(c>=x)dp[i+1][(c-x)/2]+=p.second;
//don't use
dp[i+1][c/2]+=p.second;
}
}
ll ans=0;
for(auto&p:dp[60]){
ans+=p.second;
}
return ans;
//~ }
//~ ll sum=0;
//~ rep(i,a.size()){
//~ sum+=(1LL<<i)*a[i];
//~ }
//~ ll ans=0;
//~ for(ll i=0;i<=sum;i++){
//~ auto b=a;
//~ b.resize(61);
//~ bool ok=true;
//~ for(int j=0;j<60;j++){
//~ if(i>>j&1){
//~ if(b[j]<x){ok=false;break;}
//~ b[j]-=x;
//~ }
//~ b[j+1]+=b[j]/2;
//~ }
//~ if(ok)ans++;
//~ }
//~ 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... |