#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
const int maxbits = 60;
int po[maxbits];
void init() {
po[0] = 1;
for(int i = 1; i < maxbits; i++) {
po[i] = 2 * po[i - 1];
}
}
bool good(int y, int x, vector<int> a) {
int n = (int) a.size();
for(int z = 0; z < x; z++) {
int cnt = y;
for(int i = n - 1; i >= 0; i--) {
while(cnt - po[i] >= 0 && a[i]) {
a[i]--;
cnt -= po[i];
}
}
if(cnt > 0) {
return false;
}
}
return true;
}
int count_tastiness(int x, vector<int> a) {
init();
int ans = 0;
int max_i = 0;
for(int i = 0; i < (int) a.size(); i++) {
max_i += a[i] * po[i];
}
max_i /= x;
for(int i = 0; i <= max_i; i++) {
if(good(i, x, a)) {
//cout << i << "+\n";
ans++;
} else {
//cout << i << "-\n";
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1071 ms |
296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |