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>
#define sz(x) ((int)x.size())
using namespace std;
typedef long long ll;
vector<ll> b;
ll ans, glob_x;
void rec(int ps){
if (ps == sz(b)){
ans++;
return;
}
ll mem = (b[ps]) / 2;
if (ps + 1 < sz(b)) {
b[ps + 1] += mem;
}
rec(ps + 1);
if (ps + 1 < sz(b)){
b[ps + 1] -= mem;
}
if (b[ps] >= glob_x) {
mem = (b[ps] - glob_x) / 2;
if (ps + 1 < sz(b)) {
b[ps + 1] += mem;
}
rec(ps + 1);
if (ps + 1 < sz(b)){
b[ps + 1] -= mem;
}
}
}
long long count_tastiness(long long x, std::vector<long long> a) {
glob_x = x;
b = a;
ans = 0;
rec(0);
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... |