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;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
long long count_tastiness(long long x, vector<long long> a) {
if (a.size() == 1) {
if (a[0] == 0) {
return 1;
}
a.emplace_back(0);
}
long long res = 0;
for (long long t : {0LL, x}) {
if (a[0] < t) {
continue;
}
auto b = a;
b[1] += (b[0] - t) / 2;
b.erase(b.begin());
res += count_tastiness(x, b);
}
return res;
}
#ifdef tabr
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
debug(count_tastiness(3, {5, 2, 1})); // 5
debug(count_tastiness(2, {2, 1, 2})); // 6
return 0;
}
#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... |