/**
* 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';
ll count_tastiness(ll x, vector<ll> a) {
int y = 1e5/x, n = sz(a), res = 0;
vector<ll> onki = a;
for (int i = 1; i <= y; ++i) {
int ok = 1;
for (int k = 1; k <= x; ++k) {
int need = i;
for (int t = n-1; t >= 0; --t)if (a[t] > 0 && (1ll<<t) <= need && need > 0) {
ll d = need/(1ll<<t);
d = min(d, a[t]);
need -= (1ll<<t)*d;
a[t] -= need;
}
if (need > 0) {
ok = 0;
break;
}
}
res += ok;
a = onki;
//if (ok)
//cout << i << " ";
}
//cout << nl;
return res+1;
}
//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... |