#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
#define ll long long
// #define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
const ll maxn = 1e5+5;
const int bloc = 101;
long long count_tastiness(long long x, std::vector<long long> a) {
ll mxval = 0;
REP(i, SZ(a)){
mxval += (1ll<<i) * a[i];
}
mxval /= x;
//ll cnt = 1;
vector<ll> okie;
okie.pb(0);
ll cur = 0;
for (int j = 0;;j++){
if (j < SZ(a)) cur += a[j] * (1ll<<j);
if ((1ll<<j) > mxval) break;
vector<ll> pending;
for (auto v:okie){
if (v + (1ll<<j) > mxval) break;
if ((v + (1ll<<j))*x > cur) break;
pending.pb(v + (1ll<<j));
}
for (auto v:pending) okie.pb(v);
}
return SZ(okie);
//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... |