#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
long long idx[100005];int n;long long qs[100005];int b;
bool chk(int a){
long long mi=LLONG_MAX;
for(int l=1;l<=n-a+1;l++){
int r =l+a-1;int m=(l+r)/2;
mi=min(mi,(m-l+1)*idx[m]-qs[m]-(r-m)*(idx[m])+qs[r]-qs[m]);
}
return mi<=b;
}
int besthub(int R, int L, int X[], long long B){
int l=0;int r=R;n=R;b=B;
for(int i=0;i<R;i++){idx[i+1]=X[i];qs[i+1]=qs[i]+idx[i+1];}
while(l<r){
int mid = (l+r+1)/2;
if(chk(mid)){
l=mid;
}
else{
r =mid-1;
}
}
return l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |