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>
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#define sz(x) ((int)x.size())
#define PB push_back
using namespace std;
typedef long long ll;
vector<ll> b;
ll ans, glob_x;
void rec(int ps){
if (ps == sz(b)){
ans++;
return;
}
ll mem = (b[ps]) / 2;
if (ps + 1 < sz(b)) {
b[ps + 1] += mem;
}
rec(ps + 1);
if (ps + 1 < sz(b)){
b[ps + 1] -= mem;
}
if (b[ps] >= glob_x) {
mem = (b[ps] - glob_x) / 2;
if (ps + 1 < sz(b)) {
b[ps + 1] += mem;
}
rec(ps + 1);
if (ps + 1 < sz(b)){
b[ps + 1] -= mem;
}
}
}
long long count_tastiness(long long x, std::vector<long long> a) {
glob_x = x;
b = a;
while (sz(b) < 60) b.PB(0);
ans = 0;
rec(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... |