#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
int x;
vector<int> a;
int recurse(int cur, int i) {
// if(i == 60) {
// cerr << bitset<60>(cur) << " " << i << endl;
// }
if(i == 60) return 1;
a[i+1] += a[i]/2;
int res = recurse(cur, i+1);
a[i+1] -= a[i]/2;
if(a[i] >= x) {
a[i+1] += (a[i]-x)/2;
res += recurse(cur + (1ll<<i), i+1);
a[i+1] -= (a[i]-x)/2;
}
return res;
}
long long count_tastiness(long long x_, vector<long long> a_) {
x=x_; a=a_;
if(x == 1) {
int cur = 0;
for(auto x: a)
if(x)
cur++;
return (1ll << cur);
}
while(a.size() <= 62) a.push_back(0);
int ans = recurse(0, 0);
return ans;
}
# |
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 |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1037 ms |
384 KB |
Time limit exceeded |
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 |
- |