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"
using namespace std;
typedef long long llint;
const int MAXN = 70;
const llint B = 31337;
llint x;
llint a[MAXN], dp[MAXN], pref[MAXN];
unordered_map <llint, llint> mp;
llint calc (int pos, llint ost) {
if (pos == 61) return 1;
llint h = pos * B + ost;
if (mp.find(h) != mp.end()) return mp[h];
llint res = calc(pos + 1, (ost + a[pos]) / 2);
if (ost + a[pos] >= x) {
res += calc(pos + 1, (ost + a[pos] - x) / 2);
}
return mp[h] = res;
}
llint count_tastiness (llint X, vector <llint> A) {
x = X;
for (int i = 0; i <= 60; i++) a[i] = 0;
for (int i = 0; i < (int)A.size(); i++) a[i] = A[i];
return calc(0, 0);
}
# | 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... |