#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define rept(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define vec vector
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef vec<int> vi;
typedef vec<vi> v2i;
typedef pair<int, int> pi;
typedef vec<pi> vpi;
typedef vec<bool> vb;
typedef vec<ll> vl;
long long count_tastiness(long long x, std::vector<long long> a) {
ll ans = 1;
rept(t, 1, 1e5+1) {
//cout << "\n" << t << "\n";
vl rem = a;
rem.resize(18, 0);
bool possible = true;
for(int k=0; k<=rem.size() && possible; k++) {
if (t&(1<<k)) {
// cout << "remaining of type " << k << ": " << rem[k] << endl;
if (rem[k] < x) {
// cout << "impossible: ran out of type " << k << endl;
possible = false;
} else {
rem[k+1] += (rem[k]-x)/2;
}
} else if (k<rem.size()-1) {
rem[k+1] += rem[k]/2;
}
}
if (possible) {
ans++;
// cout << "possible\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... |