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 sz(v) int(v.size())
typedef long long ll;
long long count_tastiness(long long x, std::vector<long long> a) {
int k = sz(a);
assert(x <= int(1e4));
map<ll, ll> dp;
dp[0] = 1;
for (int i = 0; i < k; i++) {
map<ll, ll> ndp;
for (auto& [k, v] : dp) {
// place a 0
ndp[(a[i] + k) / 2] += v;
// place a 1
if (a[i] + k >= x)
ndp[(a[i] + k - x) / 2] += v;
}
dp = ndp;
}
ll ans = 0;
for (auto& [k, v] : dp)
ans += v;
return ans;
}
# | 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... |