#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(v) (int)(v).size()
ll count_tastiness(ll x, vector<ll> a) {
int ans = 0;
ll sum = 0;
for (int i=0; i<sz(a); i++) {
sum += a[i] * (1LL << i);
}
assert (sum <= 100000);
for (int i=0; i<=sum; i++) {
bool check = true;
ll mask = 0; ll pf = 0;
for (int b=0; b<30 and check; b++) {
if (b < sz(a)) pf += a[b] * (1 << b);
if (((1 << b) & i)) {
mask += (1 << b);
if (mask * x > pf) check = false;
}
}
// if (check) cerr << bitset<5> (i) << ' ' << i << '\n';
if (check) assert (mask == i);
ans += check;
}
// cout << " ============================= \n";
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... |