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>
//#include "biscuits.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
#define pb push_back
#define popb pop_back
#define all(x) (x).begin(),(x).end()
int k;
vll A;
ll x;
ll count_tastiness(ll X, vll a)
{
A = a;
x = X;
k = A.size();
ll ans = 1ll;
ll sum = 0ll;
for(int i= 0; i < k ; i ++)
sum += A[i] * 1ll * (1 << i);
for(ll y = 1; y <= sum; y ++)
{
vll B = A;
bool flag = true;
for(int i = 0; i < x; i ++)
{
ll cur= y;
for(int j = k - 1; j >= 0; j --)
{
ll u = min(B[j], cur/(1 << j));
B[j] -= u;
cur -= u * (1 << j);
}
if(cur > 0)
{
flag = false;
break;
}
}
ans += (flag);
}
return ans;
}
/*
int32_t main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int k; cin >> k;
vll A(k);
ll x;
cin >> x;
for(int i = 0 ; i < k ; i ++)
cin >> A[i];
cout << count_tastiness(x,A) ;
}
*/
# | 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... |