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>
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define ef emplace_front
#define pob pop_back()
#define pof pop_front()
#define mp make_pair
#define F first
#define S second
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
typedef long long ll;
typedef long double ld;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
return o << '(' << p.F << ',' << p.S << ')';
}
long long count_tastiness(long long x, vector<long long> a){
a.resize(60);
int K = 60;
a.eb();
ll ans = 0;
vector<int> owo(K);
function<void(int)> dfs = [&](int now){
if(now == K){
ans++;
return;
}
ll tmp = a[now] / 2;
a[now + 1] += tmp;
dfs(now + 1);
a[now + 1] -= tmp;
if(a[now] < x) return;
tmp = (a[now] - x) / 2;
a[now + 1] += tmp;
owo[now] = 1;
dfs(now + 1);
owo[now] = 0;
a[now + 1] -= tmp;
};
dfs(0);
return ans;
}
# | 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... |