#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 suma_d=0, campos=0;
long jamon=0;//auxiliar
for(int i=0;i<R;i++){
deque<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 = suma_d + diferencias[k];
campos++;
}else break;
}
long long maximo = max(jamon, campos);
jamon = maximo;
suma_d=0;
campos=0;
//comparar anterior y el de ahora
//y me quedo con el mayor.
}
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 |
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 |
# |
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 |
0 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 |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 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 |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
1 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 |
1 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 |
7 ms |
204 KB |
Output is correct |
22 |
Correct |
6 ms |
204 KB |
Output is correct |
23 |
Correct |
10 ms |
204 KB |
Output is correct |
24 |
Correct |
10 ms |
304 KB |
Output is correct |
25 |
Correct |
9 ms |
204 KB |
Output is correct |
26 |
Correct |
9 ms |
204 KB |
Output is correct |
27 |
Correct |
9 ms |
204 KB |
Output is correct |
28 |
Correct |
12 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
33 ms |
204 KB |
Output is correct |
4 |
Correct |
32 ms |
296 KB |
Output is correct |
5 |
Correct |
6 ms |
304 KB |
Output is correct |
6 |
Correct |
7 ms |
204 KB |
Output is correct |
7 |
Correct |
25 ms |
312 KB |
Output is correct |
8 |
Correct |
25 ms |
312 KB |
Output is correct |
9 |
Correct |
9 ms |
300 KB |
Output is correct |
10 |
Correct |
11 ms |
308 KB |
Output is correct |
11 |
Correct |
25 ms |
204 KB |
Output is correct |
12 |
Correct |
25 ms |
308 KB |
Output is correct |
13 |
Correct |
40 ms |
204 KB |
Output is correct |
14 |
Correct |
39 ms |
204 KB |
Output is correct |
15 |
Correct |
9 ms |
204 KB |
Output is correct |
16 |
Correct |
9 ms |
304 KB |
Output is correct |
17 |
Correct |
24 ms |
204 KB |
Output is correct |
18 |
Correct |
27 ms |
304 KB |
Output is correct |
19 |
Correct |
40 ms |
296 KB |
Output is correct |
20 |
Correct |
38 ms |
204 KB |
Output is correct |
21 |
Correct |
719 ms |
340 KB |
Output is correct |
22 |
Correct |
797 ms |
340 KB |
Output is correct |
23 |
Execution timed out |
1090 ms |
332 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1095 ms |
612 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |