#include "ricehub.h"
#include <vector>
#include <algorithm>
using namespace std;
int besthub(int R, int L, int X[], long long B){
vector<int> v(R);
for(int i=0;i<R;i++)v[i]=X[i];
sort(v.begin(),v.end());
int l=0,r=R,maxi=-1;
while(l<=r){
int mid=(r-l)/2+l;
long long int i=mid+1,sum=0,c=1;
while(i<R&&sum<B){
sum+=v[i]-v[mid];
i++;
c++;
}
if(c>=maxi){
maxi=c;
r=mid-1;
}
else l=mid+1;
}
return maxi;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |