#include "biscuits.h"
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define PB push_back
using namespace std;
typedef long long ll;
vector<ll> b;
ll ans, glob_x;
void rec(int ps){
if (ps == sz(b)){
ans++;
return;
}
ll mem = (b[ps]) / 2;
if (ps + 1 < sz(b)) {
b[ps + 1] += mem;
}
rec(ps + 1);
if (ps + 1 < sz(b)){
b[ps + 1] -= mem;
}
if (b[ps] >= glob_x) {
mem = (b[ps] - glob_x) / 2;
if (ps + 1 < sz(b)) {
b[ps + 1] += mem;
}
rec(ps + 1);
if (ps + 1 < sz(b)){
b[ps + 1] -= mem;
}
}
}
long long count_tastiness(long long x, std::vector<long long> a) {
glob_x = x;
b = a;
while (sz(b) < 60) b.PB(0);
ans = 0;
rec(0);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
256 KB |
Output is correct |
4 |
Correct |
73 ms |
384 KB |
Output is correct |
5 |
Correct |
17 ms |
256 KB |
Output is correct |
6 |
Correct |
184 ms |
360 KB |
Output is correct |
7 |
Correct |
12 ms |
256 KB |
Output is correct |
8 |
Correct |
184 ms |
356 KB |
Output is correct |
9 |
Correct |
28 ms |
256 KB |
Output is correct |
10 |
Correct |
0 ms |
256 KB |
Output is correct |
11 |
Correct |
0 ms |
256 KB |
Output is correct |
12 |
Correct |
65 ms |
256 KB |
Output is correct |
13 |
Correct |
31 ms |
256 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
1096 ms |
256 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1092 ms |
256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1097 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
256 KB |
Output is correct |
4 |
Correct |
73 ms |
384 KB |
Output is correct |
5 |
Correct |
17 ms |
256 KB |
Output is correct |
6 |
Correct |
184 ms |
360 KB |
Output is correct |
7 |
Correct |
12 ms |
256 KB |
Output is correct |
8 |
Correct |
184 ms |
356 KB |
Output is correct |
9 |
Correct |
28 ms |
256 KB |
Output is correct |
10 |
Correct |
0 ms |
256 KB |
Output is correct |
11 |
Correct |
0 ms |
256 KB |
Output is correct |
12 |
Correct |
65 ms |
256 KB |
Output is correct |
13 |
Correct |
31 ms |
256 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
42 ms |
256 KB |
Output is correct |
16 |
Execution timed out |
1096 ms |
256 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |