#include "biscuits.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
int X;
ll ans = 0;
void dfs(int idx, vi &a)
{
if (idx == sz(a) - 1 && a[idx] < X)
return;
if (idx + 1 >= sz(a))
a.push_back(0);
ll oldidxplus1 = a[idx + 1];
if (a[idx] >= X)
{
++ans;
a[idx + 1] += (a[idx] - X) / 2;
dfs(idx + 1, a);
}
a[idx + 1] = oldidxplus1;
a[idx + 1] += a[idx] / 2;
dfs(idx + 1, a);
a[idx + 1] = oldidxplus1;
}
long long count_tastiness(long long _X, std::vector<long long> a)
{
X = _X;
a.push_back(0);
ans = 0;
dfs(0, a);
return ans + 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1169 ms |
1981964 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1071 ms |
212 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1043 ms |
468 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1169 ms |
1981964 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |