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;
const long long N = 100, M = (1 << 15) + 42;
bool b[M];
long long nb[N];
long long count_tastiness(long long x, vector<long long> a) {
for(int i = 0; i < N; i++)
nb[i] = 0;
for(int i = 0; i < (int)a.size(); i++)
nb[i] = a[i];
for(int i = 0; i < N-1; i++) {
if(nb[i] > x + 1) {
long long add = (nb[i] - x) / 2;
nb[i+1] += add;
nb[i] -= 2 * add;
}
}
if(x == 1) {
long long ans = 1, sum = 0;
for(int i = N-1; i > -1; i--) {
if(nb[i] == 0) {
ans *= sum + 1;
sum = 0;
} else {
sum = 2 * sum + nb[i];
}
}
ans *= sum + 1;
return ans;
}
return -1;
}
# | 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... |