# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
391201 | AlexPop28 | Packing Biscuits (IOI20_biscuits) | C++14 | 1099 ms | 119148 KiB |
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;
int n;
map<pair<int, long long>, long long> memo;
long long Solve(int i, const vector<long long> &cnt, long long s) {
if (memo.count({i, s})) return memo[{i, s}];
if (i == (int)cnt.size()) {
// cerr << "br 1: " << s << '\n';
return 1LL;
}
long long ret;
if (cnt[i] < n) {
ret = Solve(i + 1, cnt, s + (cnt[i] << i));
if (s + (cnt[i] << i) >= (n << i)) {
ret += Solve(i + 1, cnt, s + (cnt[i] << i) - (n << i));
}
} else {
ret = Solve(i + 1, cnt, s + ((cnt[i] - n) << i));
ret += Solve(i + 1, cnt, s + (cnt[i] << i));
}
// cerr << i << ' ' << s << ' ' << ret << endl;
return memo[{i, s}] = ret;
}
long long count_tastiness(long long n, vector<long long> 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... |