#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int x[], long long B) {
int MAX = 0;
for(int i = 0, j = 0;j<R;j++) {
int c = x[j] - x[(i + j)/2];
while(c > B) {
c -= x[(i + 1 + j)/2] - x[i];
i++;
}
MAX = max(MAX, j-i+1);
}
return MAX;
}
/*int main () {
int X[5] = {1, 2, 10, 12, 14};
cout<<besthub(5, 20, X, 6);
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |