Submission #590294

#TimeUsernameProblemLanguageResultExecution timeMemory
590294LucppPacking Biscuits (IOI20_biscuits)C++17
0 / 100
15 ms400 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int k = 60; ll count_tastiness(ll x, vector<ll> a) { a.resize(k); vector<ll> dp(k+1, 1); ll sum = 0; for(int i = 1; i <= k; i++){ sum += a[i-1]*(1ll<<(i-1)); ll s = sum; ll sub = 0; for(int j = i-1; j >= 0; j--){ if((s-sub)/x >= (1ll<<j)){ dp[i] += dp[j]; sub = x*(1ll<<j); } ll v = a[j]*(1ll<<j); sub = max(0ll, sub-v); s -= v; } } return dp[k]; }
#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...