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 count_tastiness(long long x, std::vector<long long> a) {
int n=60;
while((int)a.size()<n){
a.push_back(0);
}
if(x<=10000){
vector<long long>dp(x*3+10),fake(x*3+10);
long long unnow=0;
for(int i=0;i<n;i++){
a[i]+=unnow;
if(a[i]>x){
unnow=a[i]-x;
unnow/=2;
a[i]-=unnow*2;
}else{
unnow=0;
}
//cout<<i<<" "<<a[i]<<endl;
}
dp[0]=1;
for(int i=0;i<n;i++){
for(int j=0;j<=x*3;j++){
fake[j/2+a[i]]+=dp[j];
if(j/2>=(x-a[i])){
fake[j/2-(x-a[i])]+=dp[j];
}
}
for(int j=0;j<=x*3;j++){
swap(dp[j],fake[j]);
fake[j]=0;
}
}
long long mainres=0;
for(int i=0;i<=x*3;i++){
mainres+=dp[i];
}
return mainres;
}else{
return 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... |