Submission #341645

#TimeUsernameProblemLanguageResultExecution timeMemory
341645keko37Packing Biscuits (IOI20_biscuits)C++14
21 / 100
1098 ms38508 KiB
#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]; map < pair <int, llint>, llint> mp; llint calc (int pos, llint ost) { if (pos == 65) return 1; //llint h = pos * B + ost; if (mp.find({pos, ost}) != mp.end()) return mp[{pos, ost}]; 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[{pos, ost}] = res; } llint count_tastiness (llint X, vector <llint> A) { x = X; for (int i = 0; i <= 65; i++) a[i] = 0; for (int i = 0; i < (int)A.size(); i++) a[i] = A[i]; mp.clear(); return calc(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...