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;
typedef long long ll;
#define sz(x) (int)(x).size()
ll count_tastiness(ll x, vector<ll> a) {
while (sz(a) < 60)
a.push_back(0);
vector<ll> dp(61,1), pref(61,0);
dp[0] = 1;
for (int i = 0; i < 60; i++) {
pref[i] = (!i ? 0 : pref[i-1] / 2) + a[i];
ll sm = 0;
for (int j = i; j >= 0; j--) {
if (pref[j] - sm >= x) {
dp[i+1] += dp[j];
sm += x;
}
sm = 2 * (sm - a[j]);
sm = max(sm, 0ll);
}
}
return dp[60];
}
# | 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... |