#include "ricehub.h"
#include "iostream"
#include "vector"
#include "map"
#include "math.h"
#include "string"
#include "algorithm"
#include "set"
#include <iterator>
#include <string.h>
#include <queue>
#include <list>
using namespace std;
typedef long long ll ;
const ll M = 998244353 ;
const ll oo = 1e13 ;
int cost[5010][5010];
int besthub(int R, int L, int X[], long long B){
int ans = 1 ;
for(int i = 1 ; i < R ; ++i){
cost[i][0] = 0 ;
for(int j = 1 ; j < R - i + 1 ; ++j){
cost[i][j] = cost[i][j - 1] + (X[j + i - 1] - X[j / 2 + (i - 1)]) ;
}
}
for(int i = 1 ; i < R ; ++i){
int lo = 1 , hi = R - i , md , best = 1;
while(lo <= hi){
md = (lo + hi) / 2 ;
if(B >= cost[i][md]){
lo = md + 1 ;
best = md + 1 ;
}else{
hi = md - 1 ;
}
}
ans = max(ans , best);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
632 KB |
Output is correct |
5 |
Correct |
2 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
632 KB |
Output is correct |
6 |
Correct |
2 ms |
632 KB |
Output is correct |
7 |
Correct |
2 ms |
760 KB |
Output is correct |
8 |
Correct |
2 ms |
632 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
508 KB |
Output is correct |
12 |
Correct |
2 ms |
504 KB |
Output is correct |
13 |
Correct |
2 ms |
504 KB |
Output is correct |
14 |
Correct |
2 ms |
504 KB |
Output is correct |
15 |
Correct |
2 ms |
760 KB |
Output is correct |
16 |
Correct |
2 ms |
760 KB |
Output is correct |
17 |
Correct |
2 ms |
508 KB |
Output is correct |
18 |
Correct |
2 ms |
504 KB |
Output is correct |
19 |
Correct |
3 ms |
760 KB |
Output is correct |
20 |
Correct |
2 ms |
760 KB |
Output is correct |
21 |
Correct |
4 ms |
2808 KB |
Output is correct |
22 |
Correct |
4 ms |
2808 KB |
Output is correct |
23 |
Correct |
4 ms |
2808 KB |
Output is correct |
24 |
Correct |
3 ms |
2808 KB |
Output is correct |
25 |
Correct |
3 ms |
2808 KB |
Output is correct |
26 |
Correct |
4 ms |
2808 KB |
Output is correct |
27 |
Correct |
4 ms |
2808 KB |
Output is correct |
28 |
Correct |
4 ms |
2812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1144 KB |
Output is correct |
2 |
Correct |
3 ms |
1016 KB |
Output is correct |
3 |
Correct |
6 ms |
5624 KB |
Output is correct |
4 |
Correct |
6 ms |
5624 KB |
Output is correct |
5 |
Correct |
4 ms |
2784 KB |
Output is correct |
6 |
Correct |
4 ms |
2808 KB |
Output is correct |
7 |
Correct |
6 ms |
6264 KB |
Output is correct |
8 |
Correct |
6 ms |
6392 KB |
Output is correct |
9 |
Correct |
4 ms |
2812 KB |
Output is correct |
10 |
Correct |
4 ms |
2808 KB |
Output is correct |
11 |
Correct |
5 ms |
4856 KB |
Output is correct |
12 |
Correct |
5 ms |
4856 KB |
Output is correct |
13 |
Correct |
6 ms |
6264 KB |
Output is correct |
14 |
Correct |
6 ms |
6392 KB |
Output is correct |
15 |
Correct |
4 ms |
2808 KB |
Output is correct |
16 |
Correct |
4 ms |
2808 KB |
Output is correct |
17 |
Correct |
5 ms |
4856 KB |
Output is correct |
18 |
Correct |
5 ms |
4856 KB |
Output is correct |
19 |
Correct |
6 ms |
6392 KB |
Output is correct |
20 |
Correct |
7 ms |
6392 KB |
Output is correct |
21 |
Correct |
63 ms |
67320 KB |
Output is correct |
22 |
Correct |
64 ms |
67320 KB |
Output is correct |
23 |
Correct |
63 ms |
67320 KB |
Output is correct |
24 |
Correct |
63 ms |
67320 KB |
Output is correct |
25 |
Correct |
57 ms |
67320 KB |
Output is correct |
26 |
Correct |
57 ms |
67320 KB |
Output is correct |
27 |
Correct |
60 ms |
67496 KB |
Output is correct |
28 |
Correct |
61 ms |
67320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
275 ms |
204960 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |