#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const ll sz=50005;
ll a[sz], b[sz], d[sz], s[sz];
int besthub(int r, int l, int x[], long long k)
{
ll ans=0;
for(int i=0; i<r; i++){
vector<ll>v;
for(int j=0; j<r; j++){
v.push_back(abs(x[i]-x[j]));
sort(v.begin(), v.end());
}
ll sum=0;
for(int j=0; j<r; j++){
if(sum+v[j]>k) break;
sum+=v[j];
ans=max(ans, (ll)j+1);
}
}
return ans;
}
/*
{} []
5 20 6
1 2 10 12 14 3
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
452 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
3 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
4 ms |
344 KB |
Output is correct |
16 |
Correct |
4 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
3 ms |
348 KB |
Output is correct |
20 |
Correct |
3 ms |
348 KB |
Output is correct |
21 |
Correct |
552 ms |
432 KB |
Output is correct |
22 |
Correct |
566 ms |
428 KB |
Output is correct |
23 |
Correct |
747 ms |
428 KB |
Output is correct |
24 |
Correct |
745 ms |
436 KB |
Output is correct |
25 |
Correct |
730 ms |
348 KB |
Output is correct |
26 |
Correct |
773 ms |
432 KB |
Output is correct |
27 |
Correct |
725 ms |
344 KB |
Output is correct |
28 |
Correct |
837 ms |
428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
344 KB |
Output is correct |
2 |
Correct |
24 ms |
348 KB |
Output is correct |
3 |
Execution timed out |
1032 ms |
344 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1046 ms |
592 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |