#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
long long sum = 0;
int besthub(int R, int L, int X[], long long B)
{
sort(X, X+R);
int ptr = 0;
int ans = 0;
for(int i=0; i<R; i++) {
if(ptr < i) {
ptr = i;
sum = 0;
}
while(ptr<R-1 && sum - X[(i+ptr+1)/2] + X[ptr+1] <= B) {
ptr++;
sum = sum - X[(i+ptr+1)/2] + X[ptr+1];
}
ans = max(ans, ptr-i+1);
sum = sum + X[i] - X[(i+ptr)/2];
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
316 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
456 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |