#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
int count_tastiness(int x, vector<int> a) {
map<int, int> dp;
dp[0] = 1;
for (int i = 0; i < 63; i++) a.push_back(0);
int k = a.size();
for (int i = 0; i < k; i++) {
map<int, int> new_dp;
for (auto& [xi, y] : dp) {
new_dp[(xi / 2) + a[i]] += y;
if (xi >= x) new_dp[(xi - x) / 2 + a[i]] += y;
}
dp.swap(new_dp);
// cout << i << '\n';
// for (auto& [x, y] : dp) cout << "dp[" << x << "] = " << y << '\n';
new_dp.clear();
}
return (dp.count(0) ? dp[0] : 0);
}
/*
2
3 3
5 2 1
3 2
2 1 2
*/
# | 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... |