이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define pb push_back
#define pii pair<int, int>
#define sz(x) (int)x.size()
#define x first
#define y second;
#define int long long
using namespace std;
int nBags;
int solve(vector<int> pow2){
if (sz(pow2) == 0)
return 1;
if (pow2.back() == 0){
pow2.pop_back();
int res = solve(pow2);
pow2.pb(0);
return res;
}
int cur = pow2.back(), res = 0;
pow2.pop_back();
for (int bit = 0; bit < 2; ++bit){
if (cur < bit * nBags) continue;
int toAdd = (cur - bit * nBags)/2;
if (pow2.empty())
pow2.pb(0);
pow2[sz(pow2) - 1] += toAdd;
res += solve(pow2);
pow2[sz(pow2) - 1] -= toAdd;
}
pow2.pb(cur);
return res;
}
int count_tastiness(int x, vector<int> nOccs) {
reverse(all(nOccs));
nBags = x;
return solve(nOccs);
return 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... |