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;
#define vi vector<int>
#define int long long
#define pb push_back
#define ins insert
#define sz(x) (int)((x).size())
const int siz = 1e5+40;
long long count_tastiness(long long x, std::vector<long long> b) {
while (sz(b) < 61) b.push_back(0);
int dp [61][siz];
for (int i = 0; i < siz; i++) dp[61-1][i] = 1;
for (int i = 61-2; i >= 0; i--) for (int j = 0; j < siz; j++) {
int newJ = j+b[i];
dp[i][j] = dp[i+1][min(siz-1, newJ/2LL)];
if (newJ >= x) {
newJ -= x;
newJ /= 2LL;
dp[i][j] += dp[i+1][min(siz-1, newJ)];
}
}
int res = dp[0][0];
return res;
}
# | 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... |