Submission #1235056

#TimeUsernameProblemLanguageResultExecution timeMemory
1235056stanirinaPacking Biscuits (IOI20_biscuits)C++20
0 / 100
1096 ms840 KiB
#include "biscuits.h" #include<bits/stdc++.h> #define int long long using namespace std; long long count_tastiness(long long x, vector<long long> a) { int n=0ll; int ans=0ll; int k=a.size(); vector<int> potrebno(k+1,0ll); for(int i=0;i<k;i++)n+=a[i]*(1ll<<i); for(int i=0;i<n/x+1;i++){ for(int j=k;j>=0;j--){ if(i&(1<<j))potrebno[j]=x; else potrebno[j]=0ll; } bool ok=true; if(potrebno[k]==x)potrebno[k-1]+=2*x; for(int j=k-1;j>0;j--){ if(potrebno[j]<0ll || potrebno[j]>1000000000000000004ll){ ok=false; break; } potrebno[j-1]+=2ll*max(0ll,potrebno[j]-a[j]); if(potrebno[j-1]<0ll || potrebno[j-1]>1000000000000000004ll){ ok=false; break; } } if(!ok)continue; //for(int j=0;j<k+1;j++)cout<<potrebno[j]<<' '; //cout<<endl; //cout<<i<<endl; if(potrebno[0]<=a[0]){ans++;//cout<<i<<endl; } } return ans; }
#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...