이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
ll was = good;
good = 2 * good + debt;
debt = was;
}
}
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... |