#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)
{
int suma_d=0, campos=0;
int jamon=0;//auxiliar
for(int i=0;i<R;i++){
set<int>diferencias;
for(int j=0;j<R;j++){
int dif=0;
dif = abs(X[i]-X[j]);
diferencias.insert(dif);
}
set<int>::iterator it;
for(it = diferencias.begin(); it != diferencias.end(); it++){
if(suma_d + (*it) <= B){
suma_d = suma_d + (*it);
campos++;
}else break;
}
int 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 |
0 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 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
1232 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |