This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "biscuits.h"
using namespace std;
using ll = long long;
bool can(ll y, ll x, vector<ll> a){
int n = __builtin_popcountll(y);
for(int i=0; true; i++){
if(n == 0) break;
if((y & (1LL<<i)) == 0){ a[i+1] += a[i] / (ll)2; continue; }
if(a[i] < x) return false;
a[i+1] += (a[i] - x) / (ll)2;
n--;
}
return true;
}
ll count_tastiness(ll x, vector<ll> a) {
ll ret=1;
vector<ll> b(64, 0);
for(int i=0; i<(int)a.size(); i++) b[i] = a[i];
for(ll y = 1; y <= (ll)1e5; y++){
if(can(y, x, b)) ret++;
}
return ret;
}
# | 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... |