#include <bits/stdc++.h>
#include "biscuits.h"
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,unroll-loops")
using namespace std;
#define ll long long
ll count_tastiness(ll x, vector<ll> a) {
ll ans = 0, sum = 0;
int n = a.size();
for (ll i = 0; i < n; i++) sum += (1LL << i) * a[i];
for (ll y = 0; y <= sum / x; y++) {
vector<ll> c = a;
bool pos = 1;
for (int j = 0; j < x; j++) {
ll cur = 0;
for (int l = c.size() - 1; l >= 0; l--) {
ll diff = y - cur;
ll times = diff / (1LL << l);
times = min(times, c[l]);
c[l] -= times;
cur += times * (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... |