#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
long long count_tastiness( long long x, vector <long long> a ) {
const int k = a.size();
long long s, m;
unordered_map <long, long long> dp[k];
/*s = 0;
for ( int b = 0; b < k; b++ ) {
a[b] += s;
if ( a[b] > x ) {
s = a[b] - x;
a[b] = x + s % 2;
s /= 2;
} else
s = 0;
}*/
dp[0][a[0]] = 1;
if ( a[0] - x >= 0 )
dp[0][a[0] - x] = 1;
for ( int b = 1; b < k; b++ ) {
for ( auto p: dp[b - 1] ) {
s = p.first;
m = p.second;
dp[b][s / 2 + a[b]] += m;
if ( s / 2 + a[b] - x >= 0 )
dp[b][s / 2 + a[b] - x] += m;
}
}
m = 0;
for ( auto p: dp[k - 1] )
m += p.second;
return m;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |