#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<deque>
#include<string>
#include<unordered_map>
#include<bitset>
#include<random>
#include<chrono>
#include<cstdarg>
//Eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
using namespace std;
const int MAXN = 61;
typedef long long ul;
map<ul, ul> dp;
ul X;
vector<ul> psa;
ul f(ul i) {
if (i == 0) return 1;
if (i < 0) return 0;
if (dp.find(i) == dp.end()) {
ul mx = 0;
for (mx = MAXN; mx >= 0; mx--) if (i >> mx & 1) break;
dp[i] = f(i - (1LL << mx)) + f(min(i, psa[mx] / X) - (1LL << mx));
}
return dp[i];
}
ul count_tastiness(ul x, vector<ul> a) {
X = x; a.resize(MAXN);
dp = map<ul, ul>();
psa = vector<ul>(MAXN);
psa[0] = a[0];
for (int i = 1; i < MAXN; i++) psa[i] = psa[i - 1] + (a[i] << i);
return f((1LL << 60)-1);
}
# |
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 |
256 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 |
12 ms |
384 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 |
- |