# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
433055 | peuch | Packing Biscuits (IOI20_biscuits) | C++17 | 653 ms | 4332 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;
vector<map<long long, long long> > dp;
vector<int> v(60);
long long X;
long long getDP(int bit, long long cnt){
cnt += v[bit];
if(bit == 60) return 1;
if(dp[bit][cnt] != 0) return dp[bit][cnt];
dp[bit][cnt] = getDP(bit + 1, cnt / 2);
if(cnt >= X) dp[bit][cnt] += getDP(bit + 1, (cnt - X) / 2);
// printf("dp[%d][%lld] = %d\n", bit, cnt, dp[bit][cnt]);
return dp[bit][cnt];
}
long long count_tastiness(long long x, vector<long long> a) {
X = x;
v = vector<int> (60, 0);
dp = vector<map<long long, long long> > (60);
for(int i = 0; i < a.size(); i++)
v[i] = a[i];
return getDP(0, 0);
}
Compilation message (stderr)
# | 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... |