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

#TimeUsernameProblemLanguageResultExecution timeMemory
399079AntekbPacking Biscuits (IOI20_biscuits)C++14
100 / 100
18 ms1300 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; const int K=62; typedef long long ll; ll ile[K], maks[K]; ll solve(ll r, int k, bool czy){//0<=r<(1<<k) if(czy && r>=maks[k])return ile[k]; if(k==0)return (r==0); ll res=solve(min(r, 1ll<<(k-1)), k-1, 1); if(r>=(1ll<<(k-1)))res+=solve(r-(1ll<<(k-1)), k-1, 1); return res; } long long count_tastiness(long long x, std::vector<long long> a) { ll sum=0; a.resize(K); for(int i=0; i<K; i++){ maks[i]=min((1ll<<i)-1, sum/x); ile[i]=solve(maks[i], i, 0); //cout<<i<<" "<<sum<<" "<<maks[i]<<" "<<ile[i]<<"\n"; sum+=(a[i]<<i); } return ile[K-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...