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 <iostream>
#include <cstdio>
using namespace std;
// <|°_°|>
// M. Broccoli
const int NB_BITS = 60;
long long DP[NB_BITS + 1];
long long count_tastiness(long long nbPacks, vector <long long> Biscuits) {
Biscuits.resize(NB_BITS);
DP[0] = 1;
for (int i = 1; i < NB_BITS; i ++)
{
Biscuits[i] = (Biscuits[i] << i) + Biscuits[i - 1];
}
for (int i = 0; i < NB_BITS; i ++)
{
DP[i + 1] = 1;
long long sum = Biscuits[i];
for (int j = i; j >= 0; j --)
{
sum = min(sum, Biscuits[j]);
if (nbPacks <= (sum >> j))
DP[i + 1] += DP[j], sum -= (nbPacks << j);
}
}
return DP[NB_BITS];
}
# | 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... |