#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-i)*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 |
1 ms |
212 KB |
Output isn't correct |
2 |
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 |
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 |
- |