Submission #699288

#TimeUsernameProblemLanguageResultExecution timeMemory
699288uroskPacking Biscuits (IOI20_biscuits)C++14
42 / 100
1090 ms3532 KiB
#include "biscuits.h" #define here cerr<<"===========================================\n" #define dbg(x) cerr<<#x<<": "<<x<<endl; #include "bits/stdc++.h" //#include <ext/pb_ds/tree_policy.hpp> //#include <ext/pb_ds/assoc_container.hpp> #define ld double #define ll long long #define llinf 100000000000000000LL // 10^17 #define pb push_back #define popb pop_back #define fi first #define sc second #define endl '\n' #define pll pair<ll,ll> #define pld pair<ld,ld> #define sz(a) (ll)(a.size()) #define all(a) a.begin(),a.end() #define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;} #define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;} #define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0); using namespace std; ll n = 60; ll dp[61],b[61]; ll count_tastiness(ll x, vector<ll> a) { while(sz(a)<n) a.pb(0); for(ll i = 0;i<=n;i++) b[i] = a[i]; for(ll i = 1;i<=n;i++) b[i]+=b[i-1]/2; dp[0] = 1; for(ll i = 0;i<n;i++){ dp[i+1] = dp[i]; if(b[i]<x) continue; ll k = (x-a[i])*2; for(ll j = i-1;j>=0;j--){ k = max(k,0LL); dbg(k); if(b[j]>=k+x) dp[i+1]+=dp[j],k = (k+x-a[j])*2; else k = (k-a[j])*2; } k = max(k,0LL); if(k==0) dp[i+1]++; } return dp[n]; } /* 2 3 2 2 1 2 3 3 5 2 1 */
#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...