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 <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
const int maxK = 128;
long long count_tastiness(long long x, vector<long long> a) {
unordered_map<long long,long long> mp;
mp[0] = 1;
while(a.size() < maxK){
a.push_back(0);
}
for(int i = 0;i < maxK - 1;i++){
if(a[i] >= x){
a[i + 1] += (a[i] - x) / 2;
a[i] -= ((a[i] - x) / 2) * 2;
}
}
for(int i = 0;i < (int)a.size();i++){
unordered_map<long long,long long> tmp;
for(auto it2:mp){
pair<long long,long long> it = it2;
it.first += a[i];
tmp[it.first / 2] += it.second;
if(it.first >= x){
tmp[(it.first - x) / 2] += it.second;
}
}
mp = tmp;
}
return mp[0];
}
# | 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... |