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 <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#include "biscuits.h"
bool bit(ll m, int i) {
return (m >> i) & 1;
}
ll count_tastiness(ll x, vector<ll> a) {
assert(x == 1);
ll debt = 1, good = 1;
a.resize(200, 0);
for (int i = 0; i < 150; ++i) {
ll carry = (a[i] - 1) / 2;
a[i + 1] += carry;
a[i] -= 2 * carry;
}
assert(*max_element(all(a)) <= 2);
reverse(all(a));
for (ll e : a) {
if (e == 0) {
debt = good;
} else if (e == 1) {
good *= 2;
} else {
assert(e == 2);
good = 2 * good + debt;
}
}
return good;
}
#ifdef LC
#include "grader.cpp"
#endif
# | 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... |