#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
typedef long long ll;
typedef __int128 xl;
typedef pair<ll, ll> pll;
#define vc vector
#define st first
#define nd second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)a.size()
#define pub push_back
#define pob pop_back
ll count_tastiness(ll x, vc<ll> a) {
xl n = sz(a);
vc<xl> b = {0};
xl sa = 0;
for (xl i = 0; ; i++) {
if (i < n)
sa += xl(a[i]) * (xl(1) << i);
xl k = sz(b);
bool flag = false;
for (xl j = 0; j < k; j++) {
auto bj = b[j];
if (bj + xl(x) * (xl(1) << i) <= sa) {
b.pub(bj + xl(x) * (xl(1) << i));
flag = true;
} else
break;
}
if (i >= n and not flag)
break;
}
return sz(b);
}
# | 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... |