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>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vpi> vvpi;
typedef vector<vpll> vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef short int si;
typedef vector<si> vsi;
typedef vector<vsi> vvsi;
#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++)
#define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--)
#define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++)
#define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--)
#define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci
#define fi first
#define se second
#define pb push_back
#define INF(type) numeric_limits<type>::max()
#define NINF(type) numeric_limits<type>::min()
#define TCASES int t; cin >> t; while(t--)
ll count_tastiness(ll x, vll a) {
vvll dp;
ll MAX_X = 10'010ll;
ll MAX_K = 60ll;
for(ll i = 0ll; i <= MAX_K; i++) {
vll dpr(MAX_X, 1ll);
dp.pb(dpr);
}
// Extend a
while((ll)a.size() < MAX_K) {
a.pb(0ll);
}
// Remove excess
for(ll i = 0ll; i < MAX_K; i++) {
if(a[i] >= x + 2) {
ll excess = a[i] - x;
a[i + 1] += excess >> 1ll;
a[i] -= (excess >> 1ll) << 1ll;
}
}
for(ll i = MAX_K - 1ll; i >= 0; i--) {
for(ll n = 0ll; n < MAX_X; n++) {
ll aipn = a[i] + n;
if(aipn >= x) {
dp[i][n] = dp[i + 1][aipn >> 1ll] + dp[i + 1][(aipn - x) >> 1ll];
} else {
dp[i][n] = dp[i + 1][aipn >> 1ll];
}
}
}
// cout << dp[0][0] << "\n";
// cout << flush;
return dp[0][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... |