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;
ll count_tastiness(ll x, vector<ll> A) {
const int N=A.size();
vector<ll> D(N);
for(int i=1; i<N; i++) A[i]=A[i-1]+(A[i]<<i);
D[0]=(A[0]>=x)+1;
for(int i=1; i<N; i++) {
ll v=min(max(ll(1)<<i, A[i]/x), (ll(1)<<(i+1))-1);
D[i]+=(v&1)+1;
for(int j=1; j<i; j++) if(v&1<<j) D[i]+=D[j-1];
}
return accumulate(begin(D), end(D), 0);
}
# | 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... |