This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll st[70];
long long count_tastiness(long long x, std::vector<long long> a) {
ll res=1;
vector<ll> p2;
int t=a.size();
ll p=1;
for(int i=0;i<=60;i++){
p2.push_back(p);
p*=2;
}
for(int i=1;i<=100000;i++){
memset(st,0,sizeof st);
ll cl=0;
while(true){
if(cl==x){
break;
}
ll ac=0;
for(int j=t-1;j>=0;j--){
ll bi=a[j]-st[j];
if(bi!=0 && ac+p2[j]<=i){
ll ne=(i-ac)/p2[j];
if(ne>bi){
ac+=(bi*p2[j]);
st[j]=a[j];
}
else{
ac+=(ne*p2[j]);
st[j]+=ne;
}
}
}
if(ac!=i) break;
cl++;
}
if(cl==x){
// cout<<i<<endl;
res++;
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |