#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
using namespace std;
long long pre[100005]={0};
int besthub(int R,int L,int *X,long long B){
int i,j=-1,ans=0;
pre[0]=X[0];
for(i=1;i<R;i++)
pre[i]=pre[i-1]+X[i];
for(i=0;i<R;i++){
while(j+1<R&&pre[j+1]-pre[(j+1+i)/2]-(long long)X[(j+1+i)/2]*(j+1-(j+1+i)/2)+(long long)X[(j+1+i)/2]*((j+1+i)/2-i+1)-pre[(j+1+i)/2]-(i?pre[i-1]:0)<=B)
j++;
ans=max(ans,j-i+1);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |