Submission #329411

#TimeUsernameProblemLanguageResultExecution timeMemory
329411chenwzPacking Biscuits (IOI20_biscuits)C++14
0 / 100
2 ms492 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; typedef long long LL; const int N = 60; LL count_tastiness(LL x, vector<LL> a) { while (a.size() < N) a.push_back(0); vector<LL> b(a), D(N + 1, 0); for (int i = 1; i < N; ++i) b[i] += b[i - 1] / 2; for (int i = 0; i < N; ++i) { if (b[i] < x) { D[i + 1] = D[i]; continue; } LL dpv = 0, k = max(0LL, x - a[i]) * 2; for (int j = i; j > 0; --j) { if (b[j - 1] >= k + x) dpv += D[j - 1], k = max(0LL, k + x - a[j - 1]) * 2; else k = max(0LL, k - a[j - 1]) * 2; } if (k == 0) ++dpv; D[i + 1] = D[i] + dpv; } return D[N]; }
#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...