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 <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MXK = 60;
ll count_tastiness(ll x, vector<ll> a) {
a.resize(MXK);
vector<ll> f(MXK);
f[0] = 1;
for(int i = 0; i < MXK; i++) {
ll sm = 0;
ll prev = 0;
ll mx = 0;
for(int j = i; j >= 0; j--) {
// f[j] to f[i] transition
sm += a[j] * (1LL << j);
mx ^= 1 << (i - j);
ll nw = min((sm / x) >> j, mx);
f[i + 1] += f[j] * max(0ll, nw + 1 - prev);
prev = 2 * max(prev, nw + 1);
}
}
return f[59];
}
# | 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... |