#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const ll sz=5005;
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
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
3 ms |
348 KB |
Output is correct |
8 |
Correct |
3 ms |
444 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 |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
3 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
4 ms |
432 KB |
Output is correct |
20 |
Correct |
3 ms |
444 KB |
Output is correct |
21 |
Correct |
532 ms |
348 KB |
Output is correct |
22 |
Correct |
604 ms |
348 KB |
Output is correct |
23 |
Correct |
723 ms |
344 KB |
Output is correct |
24 |
Correct |
721 ms |
348 KB |
Output is correct |
25 |
Correct |
800 ms |
344 KB |
Output is correct |
26 |
Correct |
742 ms |
432 KB |
Output is correct |
27 |
Correct |
740 ms |
344 KB |
Output is correct |
28 |
Correct |
735 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
448 KB |
Output is correct |
2 |
Correct |
21 ms |
348 KB |
Output is correct |
3 |
Execution timed out |
1053 ms |
344 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1061 ms |
972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |