Submission #1052514

#TimeUsernameProblemLanguageResultExecution timeMemory
1052514ProtonDecay314Packing Biscuits (IOI20_biscuits)C++17
0 / 100
8 ms5280 KiB
#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 k = a.size(); for(ll i = 0ll; i <= k; i++) { vll dpr(MAX_X, 1ll); dp.pb(dpr); } // Remove excess for(ll i = 0ll; i < 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 = 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 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...