// biscuits-yanhao-smallAns
#include "biscuits.h"
#include <vector>
#include <cstdio>
#include <assert.h>
using namespace std;
long long arr[(int) 4e7];
long long count_tastiness(long long x, std::vector<long long> a) {
while(a.size()<=60) {
a.push_back(0);
}
vector<long long> s;
s.push_back(a[0]);
for(int i=1; i<(int) a.size(); i++) {
s.push_back(s.back() + (a[i]<<i));
}
arr[0] = 0;
int sz = 1;
for(int i=0; i<(int) s.size(); i++) {
long long threshold = min(1LL<<i, s[i]/x-(1LL<<i)+1);
for(int j=0; arr[j]<threshold; j++) {
arr[sz++] = arr[j]+(1LL<<i);
}
}
/*vector<long long> ans;
ans.reserve((int) 4e7);
ans.push_back(0);
for(int i=0; i<(int) s.size(); i++) {
if((x<<i)>(1LL<<60)) break;
long long threshold = min(1LL<<i, s[i]/x-(1LL<<i)+1);
for(int j=0; ans[j]<threshold; j++) {
ans.push_back(ans[j]+(1LL<<i));
}
}*/
//return ans.size();
return sz;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1024 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
640 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
1024 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
1024 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
256 KB |
Output is correct |
11 |
Correct |
0 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
512 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1024 KB |
Output is correct |
2 |
Runtime error |
634 ms |
634744 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
633 ms |
634744 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
110 ms |
1920 KB |
Output is correct |
2 |
Correct |
223 ms |
2552 KB |
Output is correct |
3 |
Correct |
230 ms |
2552 KB |
Output is correct |
4 |
Correct |
209 ms |
2432 KB |
Output is correct |
5 |
Correct |
207 ms |
2448 KB |
Output is correct |
6 |
Correct |
223 ms |
2456 KB |
Output is correct |
7 |
Correct |
220 ms |
2552 KB |
Output is correct |
8 |
Correct |
219 ms |
2432 KB |
Output is correct |
9 |
Correct |
221 ms |
2552 KB |
Output is correct |
10 |
Correct |
222 ms |
2432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1024 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
640 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
1024 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
1024 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
256 KB |
Output is correct |
11 |
Correct |
0 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
512 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
256 KB |
Output is correct |
15 |
Correct |
1 ms |
1024 KB |
Output is correct |
16 |
Runtime error |
634 ms |
634744 KB |
Execution killed with signal 11 |
17 |
Halted |
0 ms |
0 KB |
- |