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

#TimeUsernameProblemLanguageResultExecution timeMemory
415229mosiashvililukaPacking Biscuits (IOI20_biscuits)C++14
100 / 100
23 ms1316 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; long long a,b,c,d,e,i,j,ii,jj,zx,xc,f[209],x,S[209],JM,xr[209],E,jm,v[200009],vi,y; long long g[209]; long long tes,te; long long fun(long long q){ if(q<0) return 0; if(q==0) return 1; long long w=0; while(xr[w]<=q) w++; w--; if(xr[w+1]-1==q) return g[w+1]; y=S[w]/x; return g[w]+fun(min(y,q)-xr[w]); } long long count_tastiness(long long Xx, std::vector<long long> A) { x=Xx; a=A.size();a--; for(i=0; i<=a; i++){ f[i]=A[i]; } for(i=a+1; i<=a+135; i++){ f[i]=0; } xr[0]=1; for(i=1; i<=62; i++){ xr[i]=xr[i-1]*2; } jm=0; for(i=0; i<=a; i++){ jm+=f[i]*xr[i]; } JM=0; g[0]=1;vi=1; for(i=0; i<=a+134; i++){ JM+=f[i]*xr[i]; if(xr[i]>jm) break; S[i]=JM; y=S[i]/x; //g[i+1]=fun(xr[i+1]-1); g[i+1]=g[i]+fun(min(y,xr[i+1]-1)-xr[i]); vi=g[i+1]; } //return v.size(); return vi; } /*int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>tes; //tes=1; for(te=1; te<=tes; te++){ cin>>a>>x; vector <long long> A; for(i=0; i<a; i++){ cin>>c; A.push_back(c); } cout<<count_tastiness(x,A)<<endl; //count_tastiness(x,A); } return 0; }*/
#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...