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

#TimeUsernameProblemLanguageResultExecution timeMemory
590577ogibogi2004Packing Biscuits (IOI20_biscuits)C++14
100 / 100
38 ms1328 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; #define ll long long unordered_map<ll,ll>dp; ll s[64]; ll xx; ll calc(ll n) { if(n<=0)return 0; if(n==1)return 1; if(dp.count(n))return dp[n]; ll t=0,pw2=1; while(pw2<n){pw2*=2ll;t++;} pw2/=2ll;t--; return dp[n]=calc(pw2)+calc(min(n,1ll+s[t]/xx)-pw2); } long long count_tastiness(long long x, vector<long long> a) { dp.clear(); s[0]=a[0];xx=x; for(ll i=1;i<a.size();i++) { s[i]=s[i-1]+a[i]*(1ll<<i); } for(ll i=a.size();i<=62;i++)s[i]=s[i-1]; for(ll i=0;i<=62;i++) { calc((1ll<<i)); } return dp[(1ll<<62)]; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:21:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(ll i=1;i<a.size();i++)
      |                ~^~~~~~~~~
#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...