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;
ll x, k;
vector<ll> a;
ll solve(int idx, ll add){
//cout << "solve " << idx << " " << add << endl;
if(idx == k) return add + 1;
ll sum = a[idx] + add;
if(!sum) return solve(idx + 1, 0);
if(sum & 1) return solve(idx + 1, sum >> 1) * 2;
return solve(idx + 1, sum >> 1) + solve(idx + 1, (sum - 1) >> 1);
}
ll count_tastiness(ll _x, vector<ll> _a){
x = _x, a = _a;
k = a.size();
return solve(0, 0);
}
# | 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... |