# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769729 | boris_mihov | Packing Biscuits (IOI20_biscuits) | C++17 | 0 ms | 0 KiB |
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 <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
typedef long long llong;
const int MAXN = 64;
const int INF = 1e9;
int n;
llong x;
llong a[MAXN];
llong rec(int pos, llong prenos)
{
if (pos == n)
{
return 1;
}
llong ans = 0;
llong curr = a[pos] + prenos;
if (curr >= x) ans += rec(pos + 1, (curr - x) / 2);
ans += rec(pos + 1, curr / 2);
return ans;
}
llong count_tastiness(llong X, std::vector <llong> A)
{
n = A.size();
x = X;
llong sum = 0;
for (int i = 0 ; i < n ; ++i)
{
a[i] = A[i];
sum += a[i] * (1LL << i);
}
assert(sum <= 10000);
return brute(0, 0);
}