Submission #341663

#TimeUsernameProblemLanguageResultExecution timeMemory
341663keko37Packing Biscuits (IOI20_biscuits)C++14
42 / 100
71 ms11628 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; typedef long long llint; const int MAXN = 70; const llint B = 3133731337133731337; llint x; llint a[MAXN], val[MAXN]; llint dp[MAXN][10005]; llint calc (int pos, int del) { if (pos == 61) return 1; if (dp[pos][del] != -1) return dp[pos][del]; llint ost = val[pos] - del; llint res = calc(pos + 1, val[pos + 1] - (ost / 2 + a[pos + 1])); if (ost >= x) { res += calc(pos + 1, val[pos + 1] - ((ost - x) / 2 + a[pos + 1])); } return dp[pos][del] = res; } llint count_tastiness (llint X, vector <llint> A) { x = X; for (int i = 0; i <= 60; i++) a[i] = 0; for (int i = 0; i < (int)A.size(); i++) a[i] = A[i]; for (int i = 0; i <= 60; i++) { val[i] = a[i] + (i == 0 ? 0 : val[i - 1] / 2); } memset(dp, -1, sizeof dp); 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...