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;
const long long mod=1e9+7;
long long x,sum,curr,mult;
int k,ans;
vector<long long> br;
bool dali;
long long count_tastiness(long long X,vector<long long> A){
k=int(A.size()); x=X;
br.resize(k); ans=0;
for(int i=0;i<=100000/x;i++){
for(int f=0;f<k;f++)br[f]=A[f];
dali=true;
for(int f=0;f<x;f++){
curr=i;
for(int t=k-1;t>=0;t--){
mult=min(curr/(1LL<<t),br[t]);
curr-=mult*(1LL<<t); br[t]-=mult;
}
if(curr!=0)dali=false;
}
if(dali)ans++;
}
return ans;
}
/*
int main(){
cout<<count_tastiness(2, {2, 1, 2})<<"\n";
cout<<count_tastiness(2, {2, 1, 2})<<"\n";
}
*/
# | 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... |