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>
#include "biscuits.h"
#define ll long long
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;
const int N = 2e4;
long long count_tastiness(long long x, std::vector<long long> a) {
vector<ll> dp(N+1);
dp[0] = 1;
for (int i = 0; i < sz(a); i++) {
vector<ll> dp2(N+1);
for (int j = 0; j <= N; j++) if (dp[j]) {
if (j + a[i] >= x) dp2[min<ll>(N, (j + a[i] - x) >> 1)] += dp[j];
dp2[min<ll>(N, (j + a[i]) >> 1)] += dp[j];
}
swap(dp, dp2);
}
return accumulate(all(dp), 0LL);
}
# | 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... |