#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,m,v,a[100005],sum[100005],ans=-1;
bool check(ll l,ll r)
{
ll mid=(l+r)/2;
return ((sum[r]-sum[mid])-(sum[mid-1]-sum[l-1])-a[mid]*((r-l)&1))<=v;
}
int besthub(int n,int L,int a[], long long B)
{
for(ll i=1;i<=n;i++)
{
sum[i]=sum[i-1]+a[i];
}
for(ll l=1,r=0;l<=n;l++)
{
while(r<n&&check(l,r+1))
r++;
ans=max(ans,r-l+1);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |