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;
#define int long long
int x;
vector<int> a;
int recurse(int cur, int i) {
// if(i == 60) {
// cerr << bitset<60>(cur) << " " << i << endl;
// }
if(i == 60) return 1;
a[i+1] += a[i]/2;
int res = recurse(cur, i+1);
a[i+1] -= a[i]/2;
if(a[i] >= x) {
a[i+1] += (a[i]-x)/2;
res += recurse(cur + (1ll<<i), i+1);
a[i+1] -= (a[i]-x)/2;
}
return res;
}
long long count_tastiness(long long x_, vector<long long> a_) {
x=x_; a=a_;
while(a.size() <= 62) a.push_back(0);
int ans = recurse(0, 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... |