이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/extc++.h>
#include "biscuits.h"
namespace {
using ll = long long;
template <class T> using Vec = std::vector<T>;
template <class T, class U> using HashTable = __gnu_pbds::gp_hash_table<T, U>;
template <class F> struct RecLambda: private F {
explicit RecLambda(F&& f): F(std::forward<F>(f)) {}
template <class... Args> decltype(auto) operator() (Args&&... args) const {
return F::operator()(*this, std::forward<Args>(args)...);
}
};
}
ll count_tastiness(ll x, Vec<ll> a) {
std::array<HashTable<ll, ll>, 60> table{};
a.resize(60);
return RecLambda([&](auto&& dfs, const int k, const ll s) -> ll {
if (k == 60) return 0;
if (table[k].find(s) != table[k].end()) {
return table[k][s];
}
const auto t = s + a[k];
ll ret = dfs(k + 1, t / 2);
if (t >= x) {
ret += dfs(k + 1, (t - x) / 2);
ret += 1;
}
return table[k][s] = ret;
})(0, 0) + 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... |