/**
* In the name of Allah
* We are nothing and you're everything
**/
#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
using ll = long long;
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
//#define int long long
const char nl = '\n';
const int max_sum = 1e5;
ll count_tastiness(ll x, vector<ll> a) {
int k = sz(a);
if (x > max_sum)return 1;
auto check = [&](int y) {
vector<ll> onki = a;
int rep = x;
while (rep--) {
int want = y;
for (int t = k-1; t >= 0; --t) {
int d = min(want/(1ll<<a[t]), a[t]);
a[t] -= d; want -= (1ll<<a[t])*d;
}
if (want > 0)return false;
}
a = onki;
return true;
};
int res = 0;
for (int i = 0; i*x <= max_sum; ++i)res += check(i);
return res;
}
//int32_t main() {
//ios::sync_with_stdio(0);
//cin.tie(0);
//cout << count_tastiness(3, {5, 2, 1});
//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... |