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;
long long count_tastiness(long long x, std::vector<long long> a) {
long long ret = 1;
int k = (int) a.size();
if (x != 1) {
for (int i = 1; (long long) i * x <= (int) 1e5; ++i) {
vector<long long> b = a;
bool ok = true;
for (int rep = 0; rep < x; ++rep) {
int rem = i;
for (int j = k - 1; j >= 0; --j) {
int take = rem / (1LL << j);
int can_take = min((long long) take, b[j]);
b[j] -= can_take;
rem -= can_take * (1LL << j);
}
ok &= rem == 0;
}
ret += ok;
}
} else {
long long la = 0;
for (int i = k - 1; i >= 0; --i) {
if (a[i]) {
la += la + a[i];
}
}
ret = la + 1;
}
return ret;
}
# | 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... |