이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
long long x;
vector<long long> cnt;
//map<pair<int, long long>, long long> dp;
long long bt(int b, long long c) {
if (c == 0 && b >= (int) cnt.size()) {
return 1;
}
//if (dp.count({b, c})) {
//return dp[{b, c}];
//}
long long ret = 0;
ret = bt(b + 1, c / 2 + (b + 1 < (int) cnt.size() ? cnt[b + 1] : 0));
if (c >= x) {
ret += bt(b + 1, (c - x) / 2 + (b + 1 < (int) cnt.size() ? cnt[b + 1] : 0));
}
//cout << "B, c, x, ret: " << b << ' ' << c << ' ' << ret << endl;
return ret;
}
long long count_tastiness(long long x_, vector<long long> a) {
x = x_;
cnt = a;
//for (int i = 0; ; ++i) {
//long long cur = cnt[i];
//cout << "I: " << i << endl;
//if (cur > 1) {
//cnt[i] = cur % 2;
//if (i == (int) cnt.size() - 1) {
//cnt.push_back(cur / 2);
//} else {
//cnt[i + 1] += cur / 2;
//}
//} else if (i == (int) cnt.size() - 1) {
//break;
//}
//}
//cout << "CNT: ";
//for (int i : cnt) {
//cout << i << ' ';
//}
//cout << '\n';
//int lg = (int) cnt.size();
long long ans = bt(0, a[0]);
//dp.clear();
return ans;
}
# | 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... |