Submission #633764

#TimeUsernameProblemLanguageResultExecution timeMemory
633764tabrPacking Biscuits (IOI20_biscuits)C++17
9 / 100
1085 ms852 KiB
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif long long count_tastiness(long long x, vector<long long> a) { map<vector<long long>, long long> memo; function<long long(vector<long long>)> Solve = [&](vector<long long> b) { if (b.size() == 1) { return b[0] / x + 1; } else if (memo.count(b)) { return memo[b]; } long long res = 0; for (long long t : {0LL, x}) { if (b[0] < t) { continue; } auto c = b; c[1] += (c[0] - t) / 2; c.erase(c.begin()); res += Solve(c); } return res; }; return Solve(a); } #ifdef tabr int main() { ios::sync_with_stdio(false); cin.tie(0); debug(count_tastiness(3, {5, 2, 1})); // 5 debug(count_tastiness(2, {2, 1, 2})); // 6 return 0; } #endif
#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...