#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#include "biscuits.h"
bool bit(ll m, int i) {
return (m >> i) & 1;
}
ll count_tastiness(ll x, vector<ll> a) {
a.resize(200, 0);
for (int i = 0; i < 150; ++i) {
ll carry = max(0LL, (a[i] - x) / 2);
a[i + 1] += carry;
a[i] -= 2 * carry;
}
assert(*max_element(all(a)) <= x + 1);
reverse(all(a));
vector<ll> dp(x + 1, 0);
dp[0] = 1, dp[x] = 1;
for (ll h : a) {
// cout << "h = " << h << endl;
vector<ll> np(x + 1, 0);
for (ll k = 0; k <= x; ++k) {
// place 0
if (2 * k - h <= x) {
np[max(0LL, 2 * k - h)] += dp[k];
}
// place 1
if (2 * k - h <= 0) {
np[max(0LL, 2 * k - h + x)] += dp[k];
}
}
dp = np;
// for (ll e : dp) {
// cout << e << " ";
// }
// cout << endl;
}
return dp[0];
}
#ifdef LC
#include "grader.cpp"
#endif
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Runtime error |
3 ms |
460 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
432 KB |
Output is correct |
2 |
Correct |
23 ms |
416 KB |
Output is correct |
3 |
Correct |
17 ms |
408 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
44 ms |
460 KB |
Output is correct |
9 |
Correct |
42 ms |
448 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
7 ms |
204 KB |
Output is correct |
13 |
Correct |
51 ms |
448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1081 ms |
129484 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Runtime error |
3 ms |
460 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |