This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
res[0] = 1;
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |