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;
vector<long long> powr;
long long count_tastiness(long long x,vector<long long> a) {
long long curr = 1;
for(int i=0;i<=32;i++){
powr.push_back(curr);
curr*=2;
}
reverse(a.begin(),a.end());
int res = 1;
for(int y=1;y<=100000;y++){
if(y >= 6)break;
//cerr<<y<<": \n";
curr = y;
int pwr = a.size() -1;
for(auto i:a){
long long cnt = i;
long long p = powr[pwr];
//if(p > curr)continue;
long long take = min(cnt,curr/p);
//cerr<<curr<<" "<<pwr<<" "<<take<<endl;
curr -= take*p;
pwr--;
}
if(curr == 0)res++;
//cerr<<curr<<'\n';
}
return res;
}
// run biscuits 03.in 03.out
# | 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... |