#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
#define ll long long
ll count_tastiness(ll x, vector<ll> a) {
ll ans = 1, sum = 0;
int n = a.size();
for (ll i = 0; i < n; i++) sum += (1LL << i) * a[i];
for (ll y = 1; y <= sum / x; y++) {
vector<ll> c = a;
bool pos = 1;
for (int j = 0; j < x; j++) {
ll cur = 0;
for (int l = n - 1; l >= 0; l--) {
while (c[l] > 0 && cur + (1LL << l) <= y) {
c[l]--;
cur += (1LL << l);
}
}
if (cur != y) {
pos = 0;
break;
}
}
ans += pos;
}
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... |