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>
using namespace std;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,f[209],x,dp[209][20009];
long long count_tastiness(long long Xx, std::vector<long long> A) {
x=Xx;
a=A.size();a--;
for(i=0; i<=a; i++){
f[i]=A[i];
}
for(i=0; ; i++){
if(f[i]==0&&i>A.size()){
a=i;
break;
}
if(f[i]>x+1){
f[i+1]+=(f[i]-x)/2;
f[i]=x+(f[i]-x)%2;
}
}
a=A.size()+134;
dp[0][0]=1;
for(i=0; i<a; i++){
for(j=0; j<=20003; j++){
if(dp[i][j]==0) continue;
dp[i+1][(j+f[i])/2]+=dp[i][j];
if(j+f[i]>=x) dp[i+1][(j+f[i]-x)/2]+=dp[i][j];
}
}
//f[a]=0;pasuxi=dp[a][0]
return dp[a][0];
}
/*int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>x;
vector <long long> A;
for(i=0; i<a; i++){
cin>>c;
A.push_back(c);
}
cout<<count_tastiness(x,A);
return 0;
}*/
Compilation message (stderr)
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:12:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
12 | if(f[i]==0&&i>A.size()){
| ~^~~~~~~~~
# | 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... |