#include <bits/stdc++.h>
#define ll long long
#include "ricehub.h"
//#include "grader.cpp"
using namespace std;
ll X[100010], qs[100010];
int besthub(int R, int L, int _X[], ll B) {
for (int i = 1; i <= R; ++i) X[i] = _X[i-1];
for (int i = 1; i <= R; ++i) qs[i] = qs[i-1] + X[i];
ll l = 1, r = R;
while (l < r) {
ll mid = (l+r+1)/2;
bool y = 0;
for (ll i = 1, j = mid; j <= R; ++i, ++j) {
ll md = (i+j)/2;
if (qs[j]-qs[md]-(j-md)*X[md] + (md-l)*X[md]-qs[md-1]-qs[i-1] <= B) y = 1;
}
if (y) l = mid;
else r = mid-1;
}
return l;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |