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 "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
int X;
ll ans = 0;
void dfs(int idx, vi &a)
{
if (idx == sz(a) - 1 && a[idx] < X)
return;
if (idx + 1 >= sz(a))
a.push_back(0);
ll oldidxplus1 = a[idx + 1];
if (a[idx] >= X)
{
++ans;
a[idx + 1] += (a[idx] - X) / 2;
dfs(idx + 1, a);
}
a[idx + 1] = oldidxplus1;
a[idx + 1] += a[idx] / 2;
dfs(idx + 1, a);
a[idx + 1] = oldidxplus1;
}
long long count_tastiness(long long _X, std::vector<long long> a)
{
X = _X;
a.push_back(0);
ans = 0;
dfs(0, a);
return ans + 1;
}
# | 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... |