#include "biscuits.h"
#include <numeric>
#include <cstdio>
long long count_tastiness(long long x, std::vector<long long> a) {
a.resize(20);
long long res = 0;
for (long long i = 0; i <= 100000; ++i) {
long long c = 0, b = 1, p = i;
for (long long j = 0; j < (long long) a.size(); ++j) {
c += a[j];
if ((p >> j) & 1) {
p ^= 1 << j;
c -= x;
if (c < 0) b = 0;
}
// if (i == 8) fprintf(stderr, "%lld: %lld\n", j, c);
c /= 2;
}
if (p) b = 0;
res += b;
// if (b) fprintf(stderr, "%df\n", i);
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
74 ms |
324 KB |
Output is correct |
2 |
Correct |
73 ms |
204 KB |
Output is correct |
3 |
Correct |
72 ms |
204 KB |
Output is correct |
4 |
Correct |
72 ms |
204 KB |
Output is correct |
5 |
Correct |
72 ms |
204 KB |
Output is correct |
6 |
Correct |
72 ms |
204 KB |
Output is correct |
7 |
Correct |
74 ms |
252 KB |
Output is correct |
8 |
Correct |
75 ms |
260 KB |
Output is correct |
9 |
Correct |
72 ms |
252 KB |
Output is correct |
10 |
Correct |
77 ms |
204 KB |
Output is correct |
11 |
Correct |
74 ms |
204 KB |
Output is correct |
12 |
Correct |
73 ms |
204 KB |
Output is correct |
13 |
Correct |
75 ms |
204 KB |
Output is correct |
14 |
Correct |
74 ms |
280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
204 KB |
Output is correct |
2 |
Incorrect |
44 ms |
268 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
64 ms |
260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
74 ms |
324 KB |
Output is correct |
2 |
Correct |
73 ms |
204 KB |
Output is correct |
3 |
Correct |
72 ms |
204 KB |
Output is correct |
4 |
Correct |
72 ms |
204 KB |
Output is correct |
5 |
Correct |
72 ms |
204 KB |
Output is correct |
6 |
Correct |
72 ms |
204 KB |
Output is correct |
7 |
Correct |
74 ms |
252 KB |
Output is correct |
8 |
Correct |
75 ms |
260 KB |
Output is correct |
9 |
Correct |
72 ms |
252 KB |
Output is correct |
10 |
Correct |
77 ms |
204 KB |
Output is correct |
11 |
Correct |
74 ms |
204 KB |
Output is correct |
12 |
Correct |
73 ms |
204 KB |
Output is correct |
13 |
Correct |
75 ms |
204 KB |
Output is correct |
14 |
Correct |
74 ms |
280 KB |
Output is correct |
15 |
Correct |
72 ms |
204 KB |
Output is correct |
16 |
Incorrect |
44 ms |
268 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |