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>
#define ll long long
ll dp[70];
ll b[170];
ll count_tastiness(ll x, std::vector<ll> b){
int end=b.size();
for (int i = 0; i < 62 - end; i++) b.push_back(0);
end = 62;
for(int i=end;i+1;--i){
if(i==end){
dp[i]=1;
}
else{
dp[i]=0;
for(int j=end;j>=i+1;--j){
ll min=0,max=(1ll<<(j-i))-1,ai=0;
for(int k=j-1;k>=i;--k){
ai=ai*2+b[k];
ll y_=0;
if(k>i){
y_=(ai/x+1)<<(k-i);
if(y_>min)
min=y_;
}
else{
y_=ai/x;
if(y_<max)
max=y_;
}
}
if(min<=max)
dp[i]+=dp[j]*(max-min+1);
}
}
}
return dp[0];
}
# | 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... |