#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define int long long
using namespace std;
//#define DEBUGGING
#ifdef DEBUGGING
#include "../debug.h"
#else
#define debug(x...) void(42)
#endif
constexpr static int MXK = 62;
ll count_tastiness(ll x, vector<ll> a)
{
if (x > 1e5)
return 1;
while (a.size() < MXK-1)
a.pb(0);
for (int i = 0; i < MXK-2; i++)
{
ll change = max<ll>((a[i] - x) / 2, 0);
a[i+1] += change;
a[i] -= change * 2;
}
vector<ll> pf(MXK, 0);
for (int i = 1; i < MXK; i++)
pf[i] = pf[i-1] + (a[i-1] << (i-1));
vector<vector<ll>> dp(MXK, vector<ll>(x+3, 0)); // Last open bit
dp[0][0] = 1;
for (int i = 1; i < MXK; i++)
for (int j = 0; j < i; j++)
for (int k = 0; k < x+3; k++)
if (((pf[i] - pf[j] + (k<<(j-1)))>>(i-1)) >= x)
dp[i][((pf[i]-pf[j]+(k<<(j-1)))>>(i-1))-x] += dp[j][k];
ll res = 0;
for (int i = 0; i < MXK; i++)
for (int j = 0; j < x + 3; j++)
res += dp[i][j];
debug(dp, res);
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
292 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Execution timed out |
1088 ms |
45916 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
127 ms |
5224 KB |
Output is correct |
2 |
Correct |
105 ms |
4632 KB |
Output is correct |
3 |
Correct |
120 ms |
4908 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
303 ms |
5220 KB |
Output is correct |
9 |
Correct |
250 ms |
5208 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
5 ms |
340 KB |
Output is correct |
12 |
Correct |
47 ms |
956 KB |
Output is correct |
13 |
Correct |
305 ms |
5208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
502 ms |
30724 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
292 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Execution timed out |
1088 ms |
45916 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |