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 <iostream>
#include "biscuits.h"
#include <vector>
#include <map>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const int K = 62;
long long count_tastiness(long long x, vector<long long> a) {
map<ll, ll> dp0, dp1;
int k = a.size();
dp0[a[0]] = 1;
if (a[0] > x) {
dp0[a[0] - x] = 1;
}
for (int i = 0; i < k - 1; i++) {
for (auto jt = dp0.begin(); jt != dp0.end(); jt++) {
pll wtf = *jt;
ll j = wtf.second;
dp1[j / 2 + a[i + 1]] += dp0[j];
if (j > x) {
dp1[(j - x) / 2 + a[i + 1]] += dp0[j];
}
}
}
ll ans = 0;
for (auto it = dp1.begin(); it != dp1.end(); it++) {
ans += (*it).second;
}
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... |