Submission #430068

#TimeUsernameProblemLanguageResultExecution timeMemory
430068KeshiPacking Biscuits (IOI20_biscuits)C++17
42 / 100
1076 ms23932 KiB
//In the name of God #include<bits/stdc++.h> #include "biscuits.h" using namespace std; typedef long long ll; typedef pair<ll, ll> pll; const ll maxn = 2e5 + 100; const ll mod = 1e9 + 7; const ll inf = 1e18; const ll lg = 130; #define Mp make_pair #define F first #define S second #define pb push_back #define all(x) (x).begin(), (x).end() #define Sz(x) ll((x).size()) long long count_tastiness(long long x, vector<long long> a){ a.resize(lg, 0); for(ll i = 0; i + 1 < lg; i++){ ll y = max(0ll, (a[i] - x) / 2); a[i] -= y * 2; a[i + 1] += y; } ll ls = 0; for(ll i = 0; i < lg; i++){ if(a[i]) ls = i; } map<ll, ll> dp, dp2; dp[0] = 1; for(ll i = 0; i < ls + 2; i++){ dp2.clear(); for(pll j : dp){ dp2[(j.F + a[i]) / 2] += j.S; if(j.F + a[i] >= x) dp2[(j.F + a[i] - x) / 2] += j.S; } dp = dp2; } ll ans = 0; for(pll j : dp){ ans += j.S; } return ans; }
#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...