# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420247 | vkgainz | Packing Biscuits (IOI20_biscuits) | C++17 | 0 ms | 0 KiB |
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;
int64_t count_tastiness(int64_t x, vector<int64_t> a) {
int64_t ans = 1;
int64_t curr = 0, lst = -1;
for(int i = 0; i < (int) a.size(); i++) {
if(curr < (1LL << (i - lst)))
ans *= (curr + 1), curr = 0, lst = i;
curr += (1LL << (i - lst)) * a[i];
}
ans *= (curr + 1);
return ans;
}
int main() {
int N; cin >> N;
vector<int64_t> a(N);
for(int i = 0; i < N; i++) {
cin >> a[i];
}
cout << count_tastiness(1, a);
}