Submission #304582

#TimeUsernameProblemLanguageResultExecution timeMemory
304582johuthaPacking Biscuits (IOI20_biscuits)C++17
0 / 100
3 ms384 KiB
#include "biscuits.h" #include <vector> #include <iostream> #define int long long using namespace std; int count_tastiness(int x, vector<int> a) { a.resize(62, 0); vector<int> b; for (int i = 0; i < 62; i++) { if (i > 0) b.push_back((b.back() / 2) + a[i]); else b.push_back(a[i]); } vector<int> res(62, 0); for (int i = 0; i < 62; i++) { if (b[i] < x) continue; res[i] = 1; int need = max(0ll, 2*(x - a[i])); for (int j = i - 1; j >= 0; j--) { if (b[j] - need >= x) res[i] += res[j]; need = max(0ll, 2*(need - a[i])); } } int r = 1; for (auto i : res) { r += i; } return r; }
#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...