#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll pref[100010];
ll sum(int i, int j){ return pref[j+1]-pref[i]; }
int besthub(int n, int m, int a[], ll b)
{
pref[0] = 0; int ans = 0;
for(int i = 0; i < n; i++)
pref[i+1] = pref[i]+a[i];
for(int i = 0; i < n; i++){
int l = i, r = n-1;
while(l<r){
int mid = (l+r+1)/2;
int x = (i+mid)/2;
if(sum(x+1,mid)-sum(i,x)<=b) l=mid;
else r = mid-1;
}
ans = max(ans, l-i+1);
}
return ans;
}
# |
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 |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
580 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |