#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
long long count_tastiness(long long x, vector<long long> a) {
int sumA = 0;
for(int i = 0;i < a.size();i++) sumA += a[i]*(1LL<<i);
a.resize(61);
long long tot = 1;
for(int y = 1;y <= 100000;y++){
if(y*x > sumA) break;
vector<long long> need;
int cur = y;
while(cur) {
need.push_back((cur%2)*x);
cur /= 2;
}
// cout << need.size() << endl;
// for(auto &i:need) cout << i << " ";cout << endl;
for(int i = need.size()-1;i >= 0;i--){
need[i] = max(0LL,need[i]-a[i]);
if(i > 0) need[i-1] += 2*need[i];
}
// for(auto &i:need) cout << i << " ";cout << endl;
if(need[0] == 0) {
// cout << "!" << y << endl;
tot++;
}
}
return tot;
}
# | 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... |