# include<bits/stdc++.h>
using namespace std;
long long n,pos[100005],w,sum[100005],mid,shua,ans,sn,sm,ri;
long long besthub(int r,int l, int x[],long long b)
{
//cin>>r>>l>>b;
for (long long i=1; i<=r; i++)
{
pos[i]=x[i-1];
w+=pos[i];
sum[i]=w;
}
l=1;
ri=r;
while (l<=ri)
{
mid=(l+ri+1)/2;
for (long long i=1; i<=ri-mid+1; i++)
{
shua=(i+i+mid)/2;
sn=sum[shua-1]-sum[i-1];
sm=sum[i+mid-1]-sum[shua];
if ((pos[shua]*(shua-i)-sn)+sm-(pos[shua]*(i+mid-1-shua))<=b)
{
ans=mid;
l=mid+1;
}
else
{
ri=mid-1;
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
296 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
380 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
760 KB |
Output is correct |
2 |
Correct |
5 ms |
764 KB |
Output is correct |
3 |
Correct |
19 ms |
2296 KB |
Output is correct |
4 |
Correct |
19 ms |
2296 KB |
Output is correct |
5 |
Incorrect |
8 ms |
1272 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |