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;
long long count_tastiness(long long x, std::vector<long long> a) {
ll k = a.size();
ll tot = 0;
for(ll i= 0 ;i<k;i++) tot += a[i]<<i;
if (x>tot) return 0;
if (x==1){
ll lf = 0;
vector<ll> v;
ll cur = 0;
for(ll i = 0;i<k;i++){
if (a[i]){
ll z = 1<<(i-lf);
if (z<=cur+1){
cur += z*a[i];
}else{
v.push_back(cur);
cur = a[i];
lf = i;
}
}
}
v.push_back(cur);
ll ans = 1;
for(ll i : v) ans *= i+1;
return ans;
}
return 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... |