#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int besthub(int R, int L, int X[], long long B)
{
int ans=0;
for (int i=0; i<R; i++) {
for (int j=i; j<R; j++) {
int pos=(i+j)/2;
vector<ll> c;
for (int k=0; k<R; k++) {
c.push_back(abs(pos-X[k]));
}
sort(c.begin(),c.end());
ll used=0;
int a=0;
for (ll i: c) {
if (used+i<=B) {
used+=i;
a++;
} else break;
}
ans=max(ans,a);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1098 ms |
1172 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |