Submission #838494

#TimeUsernameProblemLanguageResultExecution timeMemory
838494caganyanmazPacking Biscuits (IOI20_biscuits)C++17
0 / 100
3 ms340 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long using namespace std; //#define DEBUGGING #ifdef DEBUGGING #include "../debug.h" #else #define debug(x...) void(42) #endif constexpr static int MXK = 61; ll count_tastiness(ll x, vector<ll> a) { int k = a.size(); debug(a); for (int i = 0; i < k-1; i++) { ll change = max<ll>((a[i] - x) / 2, 0); a[i+1] += change; a[i] -= change * 2; } vector<ll> pf(MXK); pf[0] = 0; for (int i = 1; i < MXK; i++) { pf[i] = pf[i-1]; if ((i-1)<k) pf[i] += a[i-1] << (i-1); } debug(pf); vector<ll> dp(MXK); // Last open bit dp[0] = 1; for (int i = 1; i < MXK; i++) for (int j = 0; j < i; j++) if (((pf[i] - pf[j])>>(i-1)) >= x) dp[i] += dp[j]; ll res = 0; for (int i = 0; i < MXK; i++) res += dp[i]; debug(dp, res); return res; }
#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...