#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cnt[100];
long long count_tastiness(long long x, std::vector<long long> a) {
if(x == 1) {
for(int i = (int)a.size()-1; i > 0; i--) if(a[i-1]) a[i-1] += 2*a[i], a[i] = 0;
ll res = 1;
for(ll x : a) res *= (x+1);
return res;
}
while(a.size() > 17) a.pop_back();
ll ans = 0;
for(int v = 0; v <= 100000; v++) {
for(int j = 0; j <= 16; j++) if((v>>j)&1) cnt[j] = x;
vector<ll> b = a;
for(int i = (int)b.size()-1; i >= 0; i--) {
for(int j = 16; j >= i; j--) {
while(cnt[j] && b[i] >= (1<<(j-i))) {
cnt[j]--;
b[i] -= (1<<(j-i));
}
}
}
bool flag = true;
for(int j = 0; j <= 16; j++) {
if(cnt[j]) {
flag = false;
break;
}
}
if(flag) ans++;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
302 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1074 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
302 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |