Submission #342122

#TimeUsernameProblemLanguageResultExecution timeMemory
342122chenwzPacking Biscuits (IOI20_biscuits)C++14
12 / 100
7 ms492 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; typedef long long LL; const int NN = 63; LL count_tastiness(LL x, vector<LL> a) { vector <LL> S(NN, 0), D(NN, 0); LL s = 0; for (size_t i = 0; i < NN; i++) { if (i < a.size()) s += a[i] << i; S[i] = s; } // S = ∑a(i)2^i D[0] = 1; // D(i): # of valid y ≤ 2^i for (int i = 1; i < NN; i++) { LL cur = s; D[i] = 1; for (int j = i; j--;) { // j <= i cur = min(cur, S[j]); if (cur >= x << j) cur -= x << j, D[i] += D[j]; } } return D.back(); }
#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...