#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,sse4")
#include "biscuits.h"
using L = long long;
constexpr int N = 128;
size_t l;
L b[N][2], x;
int dfs(size_t i = 0, L z = 0)
{
if (i == l - 1)
return 1 + (b[i][1] + z >= x);
int ans = dfs(i + 1, (b[i][1] + z) >> (b[i + 1][0] - b[i][0]));
if (b[i][1] + z >= x)
ans += dfs(i + 1, (b[i][1] + z - x) >> (b[i + 1][0] - b[i][0]));
return ans;
}
L count_tastiness(L x_, std::vector<L> a)
{
x = x_;
l = 0;
for (size_t i = 0; i < a.size(); ++i)
if (a[i])
b[l][0] = i, b[l][1] = a[i], ++l;
return l ? dfs() : 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |