#include "biscuits.h"
#include <bits/stdc++.h>
#define N 200005
using namespace std;
long long vals[N];
long long count_tastiness(long long x, vector<long long> a){
int k = a.size();
vector<long long> pre = a;
for(int i = 1;i<k;i++){
pre[i] = pre[i-1] + a[i] * (1ll<<i);
}
for(int i = 0;i<k;i++){
pre[i] /= x;
}
for(int i = k-2;i>=0;i--){
pre[i] = min(pre[i],pre[i+1]);
}
while(pre.size() < 60)
pre.push_back(pre.back());
vals[0] = 0;
int sz = 1;
for(int i = 0;i<60;i++){
int tmp = sz;
for(int j = 0;j<tmp;j++){
if(vals[j] + (1ll<<i) <= pre[i]){
vals[sz++] = vals[j] + (1ll<<i);
}
else break;
}
}
long long ans = sz;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
980 KB |
Output is correct |
7 |
Correct |
1 ms |
316 KB |
Output is correct |
8 |
Correct |
1 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Runtime error |
3 ms |
3540 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
3544 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
1920 KB |
Output is correct |
2 |
Correct |
140 ms |
2388 KB |
Output is correct |
3 |
Correct |
165 ms |
2260 KB |
Output is correct |
4 |
Correct |
138 ms |
2368 KB |
Output is correct |
5 |
Correct |
140 ms |
2332 KB |
Output is correct |
6 |
Correct |
147 ms |
2372 KB |
Output is correct |
7 |
Correct |
149 ms |
2388 KB |
Output is correct |
8 |
Correct |
147 ms |
2384 KB |
Output is correct |
9 |
Correct |
148 ms |
2376 KB |
Output is correct |
10 |
Correct |
146 ms |
2388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
980 KB |
Output is correct |
7 |
Correct |
1 ms |
316 KB |
Output is correct |
8 |
Correct |
1 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
980 KB |
Output is correct |
16 |
Runtime error |
3 ms |
3540 KB |
Execution killed with signal 11 |
17 |
Halted |
0 ms |
0 KB |
- |