This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Mayoeba Yabureru
*/
#include<bits/stdc++.h>
using namespace std;
long long count_tastiness(long long x, vector<long long> a) {
while (a.size() != 200) a.push_back(0);
a.insert(a.begin(), 0);
vector<vector<pair<long long, long long>>> dp(202);
dp[0].push_back({0, 1});
long long ans = 0;
for (int i = 1; i <= 150; i ++) {
if (i > 60 && dp[i - 1].size() == 0 && dp[i - 1][0].first == 0) break;
map<long long, long long> dpp;
for (auto [aa, y] : dp[i - 1]) {
dpp[aa / 2 + a[i]] += y;
if (aa / 2 + a[i] >= x) dpp[aa / 2 + a[i] - x] += y;
}
for (auto x : dpp) dp[i].push_back(x);
ans = dp[i][0].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... |