Submission #303497

#TimeUsernameProblemLanguageResultExecution timeMemory
303497tutisPacking Biscuits (IOI20_biscuits)C++17
9 / 100
1097 ms63520 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll count_tastiness(ll x, vector<ll> a) { while (a.size() < 130) a.push_back(0); // ll s[131]; // for (int i = 0; i <= 130; i++) // s[i] = 0; // for (int t = 1; t <= 130; t++) // { // s[130 - t] = s[130 - t + 1] + a[130 - t]; // if (s[130 - t] >= 2 * x) // s[130 - t] -= 2 * x; // for (int i = 0; i < 130; i++) // { // s[i] *= 2; // if (s[i] >= 2 * x) // s[i] -= 2 * x; // } // } map<ll, int>M[130]; function<ll(ll, int)>get = [&](ll d, int i)->ll { if (i == 130) return 1; if (M[i].count(d)) return M[i][d]; if (a[i] + d < x) { return M[i][d] = get((d + a[i]) / 2, i + 1); } else { return M[i][d] = get((d + a[i]) / 2, i + 1) + get((d + a[i] - x) / 2, i + 1); } }; return get(0, 0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...