#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
long long count_tastiness( long long x, vector <long long> a ) {
const int k = 60;
long long s;
vector <long long> dp[k];
a.resize( k );
s = 0;
for ( int b = 0; b < k; b++ ) {
a[b] += s;
if ( a[b] > x ) {
s = a[b] - x;
a[b] = x + s % 2;
s /= 2;
} else
s = 0;
}
dp[0].push_back( a[0] );
if ( a[0] - x >= 0 )
dp[0].push_back( a[0] - x );
for ( int b = 1; b < k; b++ ) {
for ( long long s: dp[b - 1] ) {
dp[b].push_back( s / 2 + a[b] );
if ( s / 2 + a[b] - x >= 0 )
dp[b].push_back( s / 2 + a[b] - x );
}
}
return dp[k - 1].size();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
35944 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
732 KB |
Output is correct |
4 |
Correct |
50 ms |
18636 KB |
Output is correct |
5 |
Correct |
13 ms |
5620 KB |
Output is correct |
6 |
Correct |
136 ms |
36856 KB |
Output is correct |
7 |
Correct |
10 ms |
3228 KB |
Output is correct |
8 |
Correct |
134 ms |
36908 KB |
Output is correct |
9 |
Correct |
24 ms |
6356 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
48 ms |
7696 KB |
Output is correct |
13 |
Correct |
22 ms |
3700 KB |
Output is correct |
14 |
Correct |
3 ms |
716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
36060 KB |
Output is correct |
2 |
Execution timed out |
1119 ms |
661260 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1125 ms |
913664 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
70308 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
35944 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
732 KB |
Output is correct |
4 |
Correct |
50 ms |
18636 KB |
Output is correct |
5 |
Correct |
13 ms |
5620 KB |
Output is correct |
6 |
Correct |
136 ms |
36856 KB |
Output is correct |
7 |
Correct |
10 ms |
3228 KB |
Output is correct |
8 |
Correct |
134 ms |
36908 KB |
Output is correct |
9 |
Correct |
24 ms |
6356 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
48 ms |
7696 KB |
Output is correct |
13 |
Correct |
22 ms |
3700 KB |
Output is correct |
14 |
Correct |
3 ms |
716 KB |
Output is correct |
15 |
Correct |
40 ms |
36060 KB |
Output is correct |
16 |
Execution timed out |
1119 ms |
661260 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |