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 "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 65;
int n;
long long x;
long long a[maxn];
long long f(int pos, long long carry)
{
if (pos == n)
{
return carry / x + 1;
}
carry += a[pos];
long long ans = f(pos + 1, carry / 2);
if (carry >= x)
{
ans += f(pos + 1, (carry - x) / 2);
}
return ans;
}
long long count_tastiness(long long X, vector<long long> arr)
{
n = arr.size();
x = X;
for (int i = 0; i < n; ++i)
{
a[i] = arr[i];
}
return f(0, 0);
}
/*
1
3 3
5 2 1
1
3 2
2 1 2
*/
# | 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... |