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>
using namespace std;
const int LIMIT = 60;
long long DP[LIMIT+2][20004];
long long count_tastiness(long long x, std::vector<long long> a) {
DP[0][0]=1;
a.resize(LIMIT+2);
for(int i=0;i<=LIMIT;i++){
if(a[i]<x+2ll)continue;
long long can = a[i]-x;
can/=2ll;
a[i+1]+=can;
a[i]-=2ll*can;
}
for(long long i=0;i<=LIMIT;i++){
for(long long j=0;j<=20003;j++){
DP[i+1][j] = DP[i][max(0ll,min(20003ll,2ll*(j-a[i])))] + DP[i][max(0ll,min(20003ll,2ll*(j-a[i]+x)))];
}
}
return DP[LIMIT+1][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... |