#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define uwu return
long long count_tastiness(long long x, vector<long long> a) {
long long ans = 0;
for (int i = 0; i < a.size(); i++){
vector <long long> b = a;
long long tmp = 0;
for (int j = 0; j < i; j++){
tmp += b[j] * (1LL << j);
b[j] = 0;
}
b[i] += tmp / (1LL << i);
if(b[i] < x)
continue;
long long cnt = 0;
for (int j = i + 1; j < b.size(); j++){
if(b[j - 1] >= x){
b[j] += (b[j - 1] - x) / 2;
b[j - 1] = x;
}
cnt += (b[j] >= x);
}
ans += (1LL << cnt);
}
return ans + 1;
}
# | 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... |