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"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
map<ll, ll>mp;
vector<ll>pre;
ll f(ll x) {
if (x <= 0)return 0;
if (mp.find(x) != mp.end())return mp[x];
int bit = 63 - __builtin_clzll(x - 1);
return f((1ll << bit)) + f(min(x, 1 + pre[bit] / x) - (1ll << bit));
}
long long count_tastiness(long long x, vector<long long> A) {
ll k = A.size(), sum = 0;
for (ll i = 0; i < k; i++) {
sum += (A[i] << i);
pre.push_back(sum / x);
}
for (int i = k; i <= 59; i++)pre.push_back(sum/x);
mp[1] = 1;
return f(1ll << 61);
}
# | 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... |