(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 #303874

#TimeUsernameProblemLanguageResultExecution timeMemory
303874aintaPacking Biscuits (IOI20_biscuits)C++17
100 / 100
70 ms1024 KiB
#include "biscuits.h" #include<algorithm> #include<map> using namespace std; long long S[61]; map<long long, long long>Map[61]; long long Go(int pv, long long M){ M=min(M,S[pv]); M=min(M,2ll<<pv); if(Map[pv].count(M))return Map[pv][M]; long long t = (1ll<<pv), s = 0; if(t <= M){ if(pv==0) s++; else s += Go(pv-1,M-t); } if(pv==0)s++; else s += Go(pv-1,M); return Map[pv][M]=s; } long long count_tastiness(long long x, std::vector<long long> a) { int n = a.size(); int i; for(i=0;i<=60;i++)Map[i].clear(); for(i=0;i<n;i++){ S[i] = (a[i]<<i); if(i)S[i]+=S[i-1]; } for(i=n;i<=60;i++)S[i]=S[i-1]; for(i=0;i<=60;i++)S[i]/=x; return Go(60,(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...