#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std; //si solo era esto me muero >:v.
int besthub(int R, int L, int X[], long long B)
{
long long suma_d=0, campos=0;
long long jamon=0;//auxiliar
for(int i=0;i<R;i++){
vector<long long>diferencias(R);
for(int j=0;j<R;j++)diferencias[j] = abs(X[i]-X[j]);
sort(diferencias.begin(), diferencias.end());
for(int k=0;k<R;k++){
if(suma_d + diferencias[k] <= B){
suma_d += diferencias[k];
campos++;
}else break;
}
long long maximo = max(jamon, campos);
jamon = maximo;
suma_d=0;
campos=0;
}
return jamon;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
3 ms |
204 KB |
Output is correct |
22 |
Correct |
3 ms |
204 KB |
Output is correct |
23 |
Correct |
6 ms |
204 KB |
Output is correct |
24 |
Correct |
7 ms |
204 KB |
Output is correct |
25 |
Correct |
8 ms |
204 KB |
Output is correct |
26 |
Correct |
6 ms |
204 KB |
Output is correct |
27 |
Correct |
7 ms |
204 KB |
Output is correct |
28 |
Correct |
6 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
19 ms |
308 KB |
Output is correct |
4 |
Correct |
19 ms |
204 KB |
Output is correct |
5 |
Correct |
3 ms |
204 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
13 ms |
312 KB |
Output is correct |
8 |
Correct |
13 ms |
308 KB |
Output is correct |
9 |
Correct |
6 ms |
312 KB |
Output is correct |
10 |
Correct |
6 ms |
204 KB |
Output is correct |
11 |
Correct |
19 ms |
204 KB |
Output is correct |
12 |
Correct |
15 ms |
204 KB |
Output is correct |
13 |
Correct |
29 ms |
324 KB |
Output is correct |
14 |
Correct |
24 ms |
204 KB |
Output is correct |
15 |
Correct |
6 ms |
304 KB |
Output is correct |
16 |
Correct |
6 ms |
204 KB |
Output is correct |
17 |
Correct |
15 ms |
308 KB |
Output is correct |
18 |
Correct |
15 ms |
312 KB |
Output is correct |
19 |
Correct |
24 ms |
300 KB |
Output is correct |
20 |
Correct |
24 ms |
308 KB |
Output is correct |
21 |
Correct |
460 ms |
336 KB |
Output is correct |
22 |
Correct |
401 ms |
452 KB |
Output is correct |
23 |
Correct |
841 ms |
348 KB |
Output is correct |
24 |
Correct |
868 ms |
340 KB |
Output is correct |
25 |
Correct |
801 ms |
340 KB |
Output is correct |
26 |
Correct |
769 ms |
340 KB |
Output is correct |
27 |
Correct |
702 ms |
340 KB |
Output is correct |
28 |
Correct |
730 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
460 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |