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;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
typedef long long int lld;
lld arr[100];
int k;
vector<lld> V;
vector<lld> NXT;
lld ans;
void calc(int pos, lld x){
if(pos==60)return;
NXT.clear();
trav(a,V){
if(a+arr[pos]>=x){
NXT.push_back((a+arr[pos]-x)/2);
ans++;
}
NXT.push_back((a+arr[pos])/2);
}
V.clear();
trav(a,NXT){
V.push_back(a);
}
NXT.clear();
calc(pos+1,x);
}
long long count_tastiness(long long x, std::vector<long long> a) {
rep(i,0,100)arr[i]=0;
V.clear();
NXT.clear();
k=a.size();
rep(i,0,k)arr[i]=a[i];
V.push_back(0);
ans=0;
calc(0,x);
return ans+1;
}
# | 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... |