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>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
using namespace std;
#define int long long
map <int, int> mp[61];
int a[61], x;
int solve (int b, int k) {
if (b == 60)
return 1;
if (mp[b][k])
return mp[b][k];
int ans = solve (b + 1, ((a[b] + k) / 2));
if ((a[b] + k) >= x) {
ans += solve (b + 1, ((a[b] + k - x) / 2));
}
return mp[b][k] = ans;
}
long long count_tastiness(long long xx, std::vector<long long> aa) {
assert (x <= 200000);
for (int i = 0; i < 61; i++)
mp[i].clear();
x = xx;
for (int i = 0; i < (int)aa.size(); i++)
a[i] = aa[i];
return solve (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... |