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 <bits/stdc++.h>
using namespace std;
#include "biscuits.h"
long long count_tastiness(long long x, std::vector<long long> a) {
int n=a.size();
long long cur=0;
for (int i = 0; i < n; ++i)
{
cur+=a[i]*(1<<i);
}
if(x>cur/x) return 1;
int ans=1;
for (int i = 1; i <= cur/x; ++i)
{
bool test=true;
vector<long long> b=a;
for (int j = 0; j < x; ++j)
{
for (int k = min(n-1,16); k >= 0; k--)
{
if(!((1<<k)&i)) continue;
bool cur=false;
for (int t = k; t >= 0; t--)
{
if(b[t]>=(1<<(k-t))){
b[t]-=(1<<(k-t));
cur=true;
break;
}
}
test&=cur;
}
}
ans+=test;
}
return ans;
}
# | 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... |