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;
typedef long double ld;
typedef ll itn;
#define ff first
#define ss second
ll n;
ll lg;
ll ans=0;
map<int, int>dp[2];
ll count_tastiness(ll x, vector<ll> a) {
n = a.size();
ll sum = 0;
for (int i = 0; i < n; i++) {
sum += a[i] * (1ll << i);
}
dp[0][0]=1;
for(int i=0;i<n;i++){
for(auto c:dp[0]){
if(c.ff+a[i]-x>=0){
dp[1][(c.ff+a[i]-x)/2]+=c.ss;
}
dp[1][(c.ff+a[i])/2]+=c.ss;
}
dp[0]=dp[1];
dp[1].clear();
}
for(auto c:dp[0]){
ans+=c.ss;
}
return ans;
}
/*
1
3 2
2 1 2
*/
# | 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... |