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 all(x) x.begin(), x.end()
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define pb push_back
#define pii pair<int, int>
#define sz(x) (int)x.size()
#define x first
#define y second;
#define int long long
using namespace std;
int nBags;
int solve(vector<int> pow2){
if (sz(pow2) == 0)
return 1;
if (pow2.back() == 0){
pow2.pop_back();
int res = solve(pow2);
pow2.pb(0);
return res;
}
int cur = pow2.back(), res = 0;
pow2.pop_back();
for (int bit = 0; bit < 2; ++bit){
if (cur < bit * nBags) continue;
int toAdd = (cur - bit * nBags)/2;
if (pow2.empty())
pow2.pb(0);
pow2[sz(pow2) - 1] += toAdd;
res += solve(pow2);
pow2[sz(pow2) - 1] -= toAdd;
}
pow2.pb(cur);
return res;
}
int count_tastiness(int x, vector<int> nOccs) {
reverse(all(nOccs));
nBags = x;
return solve(nOccs);
return 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... |