using namespace std;
#include <bits/stdc++.h>
#include "biscuits.h"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<bool> vb;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back
ll count_tastiness(ll x, vector<ll> a) {
int k = a.size() + 65;
rep(i,0,k) a.pb(0);
rep(i,0,k-1) {
if (a[i] <= x) continue;
a[i + 1] += (a[i] - x) / 2;
a[i] = x + ((a[i] - x) & 1);
}
vector<vector<ll>> dp(k, vector<ll>(2*x+6, 0));
dp[0][a[0]] = 1;
if (a[0] >= x) dp[0][a[0] - x] = 1;
rep(i,0,k-1) rep(j,0,2*x+6) {
dp[i+1][a[i+1] + j/2] += dp[i][j];
if (a[i+1] + j/2 >= x) dp[i+1][a[i+1] + j/2 - x] += dp[i][j];
}
ll ans = 0;
rep(j,0,2*x+6) ans += dp[k-1][j];
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
2 ms |
552 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 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 |
304 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
19788 KB |
Output is correct |
2 |
Correct |
37 ms |
9848 KB |
Output is correct |
3 |
Correct |
41 ms |
10592 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 |
308 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
180 ms |
20436 KB |
Output is correct |
9 |
Correct |
98 ms |
11172 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
3 ms |
564 KB |
Output is correct |
12 |
Correct |
22 ms |
2996 KB |
Output is correct |
13 |
Correct |
182 ms |
19924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
951 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
2 ms |
552 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |