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;
long long count_tastiness(long long x, std::vector<long long> a) {
long long ans = 1;
vector<vector<long long>> d(101, vector<long long>(2, 0ll));
while((int)a.size() < 70)a.push_back(0ll);
if(a[0] > 0)d[0][0] = 1,ans++;
for(int i = 1; i < 61; i++){
if(a[i] > 0){
for(int j = i - 1; j >= 0; j--){
d[i][0] += d[j][0] + d[j][1];
}
d[i][0]++;
ans += d[i][0];
}
for(int j = i - 1; j >= 0; j--){
long long x = 0;
for(int h = j + 1; h < i; h++)x += (1ll << h) * a[h];
if(a[j] > 0)x += (1ll << j) * (a[j] - 1);
if(x >= (1ll << i))d[i][1] += d[j][0];
if(a[j] > 0){
x += (1ll << j);
}
if(x >= (1ll << i))d[i][1] += d[j][1];
}
if(a[i] == 0)ans += d[i][1];
}
return ans;
}
# | 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... |