(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #370083

#TimeUsernameProblemLanguageResultExecution timeMemory
370083MilosMilutinovicPacking Biscuits (IOI20_biscuits)C++14
100 / 100
87 ms1388 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int N=62; ll x; map<ll, ll> dp; vector<ll> pref; ll Solve(ll n) { if(n<=0) return (ll)0; if(n==1) return (ll)1; if(dp.find(n)!=dp.end()) return dp[n]; ll i=__lg(n-1); ll ans=Solve((ll)(1LL<<i))+Solve(min(n,pref[i]/x+1)-(ll)(1LL<<i)); dp[n]=ans; return dp[n]; } ll count_tastiness(ll X, vector<ll> a) { x=X; dp.clear(); pref.clear(); for(ll i=0; i<(int)a.size(); ++i) { if(i>0) a[i]=a[i-1]+a[i]*(ll)(1LL<<i); pref.pb(a[i]); } for(int i=(int)a.size(); i<61; ++i) pref.pb(pref.back()); return Solve((ll)(1LL<<60)); }
#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...