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>
typedef long long ll;
using namespace std;
long long count_tastiness(long long x, std::vector<long long> a) {
ll k = a.size();
vector<ll> maxVal(k);
maxVal[0] = a[0];
ll sizes = a[0] + 1; //1s plus the case where there are no biscuits in the bag
ll power2 = 2;
for (int i = 1; i < k; i++)
{
sizes += a[i] - maxVal[i - 1]/power2; //every biscuit size not possible due to previous sums
sizes += a[i]; //every biscuit size past maxVal[i - 1];
maxVal[i] = maxVal[i - 1] + power2*a[i];
power2 *= 2;
}
return sizes;
}
# | 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... |