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;
bool can_make(vector<long long> nums, long long x) {
for(int i = 0; i < (int) nums.size(); i++) {
if(nums[i] < x) return false;
nums[i] -= x;
if(i < (int) nums.size() - 1) nums[i + 1] += nums[i] / 2;
}
return true;
}
long long count_tastiness(long long x, vector<long long> a) {
long long ans = 1;
long long curr = a[0], lst = 0;
for(int i = 1; i < (int) a.size(); i++) {
vector<long long> temp;
for(int x = lst; x < i; x++) {
temp.push_back(a[x]);
}
if(!can_make(temp, x))
ans *= (curr + x) / x, curr = 0, lst = i;
curr += (1LL << (i - lst)) * a[i];
}
ans *= ((curr + x) / x);
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... |