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;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
vector<ll>T;
map<pair<ll,ll>,ll>mp;
ll x;
ll solve(ll a, ll b) {
if(a==T.size()) return 1;
b+=T[a];
if(mp.find({a, b})!=mp.end()) return mp[{a, b}];
if(a==T.size()) return 1;
mp[{a, b}]=solve(a+1, b/2);
if(b>=x) mp[{a, b}]+=solve(a+1, (b-x)/2);
return mp[{a, b}];
}
ll count_tastiness(ll _x, vector<ll>_T) {
mp.clear();
T=_T;
x=_x;
return solve(0, 0);
}
Compilation message (stderr)
biscuits.cpp: In function 'll solve(ll, ll)':
biscuits.cpp:14:7: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
14 | if(a==T.size()) return 1;
| ~^~~~~~~~~~
biscuits.cpp:17:7: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | if(a==T.size()) return 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... |