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()
ll X;
long long count_tastiness(long long _X, std::vector<long long> a)
{
for (int i = 0; i < sz(a); ++i)
{
if (a[i] >= 3)
{
if (i + 1 < sz(a))
a.push_back(0);
if (a[i] & 1)
a[i + 1] += a[i] / 2, a[i] = 1;
else if (a[i] > 0)
a[i + 1] += a[i] / 2 - 1, a[i] = 2;
}
}
a.push_back(0);
ll ans = 1;
ll base = 1;
ll tmp = 1;
for (int i = 0; i < sz(a); ++i)
{
if (a[i] == 0)
{
ans *= tmp;
tmp = 1;
base = 1;
}
else
{
tmp += base * a[i];
base *= 2;
}
}
return ans;
}
# | 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... |