Submission #422350

#TimeUsernameProblemLanguageResultExecution timeMemory
422350TLP39Packing Biscuits (IOI20_biscuits)C++14
0 / 100
1 ms332 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; long long k; long long ans[60],limit[60]; long long que(long long x,long long pos) { if(x>=limit[pos]) return ans[pos]; if(x<0) return 0; if(pos==0) return x+1; return que(x,pos-1)+que(x-(1ll<<pos),pos-1); } long long count_tastiness(long long x, std::vector<long long> a) { k=a.size(); limit[0]=a[0]; for(int i=1;i<k;i++) limit[i]=limit[i-1]+(a[i]<<i); for(int i=0;i<k;i++) limit[i]=min((1ll<<(i+1))-1,limit[i]/x); ans[0]=limit[0]+1; for(int i=1;i<k;i++) ans[i]=que(limit[i],i-1)+que(limit[i]-(1ll<<i),i-1); return ans[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...