#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll count_tastiness(ll x, vector<ll> a) {
a.resize(20);
function<ll(int, ll)> f = [&] (int i, ll y) {
if(i < 0) return (ll)(y == 0);
y = y - a[i] * (1LL << i);
return f(i - 1, max(0ll, y)) + f(i - 1, max(0ll, y + x * (1LL << i)));
};
return f(19, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
348 KB |
Output is correct |
2 |
Incorrect |
92 ms |
416 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
348 KB |
Output is correct |
2 |
Incorrect |
55 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
83 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1093 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
348 KB |
Output is correct |
2 |
Incorrect |
92 ms |
416 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |