#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const ll sz=5005;
ll a[sz], b[sz], d[sz];
int besthub(int r, int l, int x[], long long k)
{
for(int i=0; i<r; i++){
for(int j=0; j<i; j++){
d[i]+=x[i]-x[j];
}
//cout<<d[i]<<' ';
}
ll ans=0;
for(int i=0; i<r; i++){
for(int j=i; j<r; j++){
ll m=(i+j)/2+1;
if(m>=r) continue;
ll num1=(d[m]-d[i])-i*(x[m]-x[i]);
ll num2=(d[j]-d[m])-m*(x[j]-x[m]);
if(num1+num2<=k){
ans=max(ans, (ll)j-i+1);
//cout<<i<<' '<<j<<' '<<num1<<' '<<num2<<' '<<ans<<endl;
}
}
}
return ans;
}
/*
{} []
5 20 6
1 2 10 12 14 3
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
452 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
561 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |