#include "ricehub.h"
#include<bits/stdc++.h>
const int N = 2e5 + 5;
#define ll long long
using namespace std;
ll a[N], pre[N], n, m, x, y;
ll calc(int x, int y) {
ll ans = 0;
int t = (x + y) / 2;
return max(a[t] - a[x], a[y] - a[t]);
}
int besthub(int R, int L, int X[], long long B) {
n = R;
for(int i = 1; i <= n; i++) {
a[i] = X[i-1];
pre[i] = pre[i-1] + a[i];
}
int j = 0, ans = 0;
ll p = B;
for(int i = 1; i <= n; i++) {
while(calc(i, j+1) <= p && j + 1 <= n) j++;
ans = max(ans, j - i + 1);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
8752 KB |
Output is correct |
2 |
Incorrect |
0 ms |
8752 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
8752 KB |
Output is correct |
2 |
Correct |
0 ms |
8752 KB |
Output is correct |
3 |
Correct |
0 ms |
8752 KB |
Output is correct |
4 |
Incorrect |
0 ms |
8752 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
8752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
8752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |