This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,sse4")
#include "biscuits.h"
using L = long long;
constexpr int N = 128;
size_t l;
L b[N][2], x;
L dfs(size_t i = 0, L z = 0)
{
if (i == l - 1)
return 1 + (b[i][1] + z >= x);
L ans = dfs(i + 1, (b[i][1] + z) >> (b[i + 1][0] - b[i][0]));
if (b[i][1] + z >= x)
ans += dfs(i + 1, (b[i][1] + z - x) >> (b[i + 1][0] - b[i][0]));
return ans;
}
L count_tastiness(L x_, std::vector<L> a)
{
x = x_;
l = 0;
for (size_t i = 0; i < a.size(); ++i)
if (a[i])
b[l][0] = i, b[l][1] = a[i], ++l;
return l ? dfs() : 0;
}
# | 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... |