#define USECHRONO #undef HAVE_MPI #include "eval.hpp" #include #include #include #include using namespace aed; using namespace std; //---:---<*>---:---<*>- COMIENZA CODIGO FUNCION --:---<*>---:---<*>---:---<*> // COMPLETAR DNI y NOMBRE AQUI: // Nombre: Bob Esponja int DNI=98765432; void get_sub_prop(set S, list> &sub_prop){ set::iterator it = S.begin(); int sub = S.size(); while(it!=S.end()){ set::iterator it2 = S.begin(); set tmp; tmp.insert(*it); while(it2!=S.end()){ tmp.insert(*it2); if(sub>tmp.size()){ sub_prop.push_back(tmp); } it2++; } it = S.erase(it); } } float promedio(set S){ int suma=0; int cont =0; while(!S.empty()){ suma+=*S.begin(); S.erase(S.begin()); cont++; } if(cont==0) return cont; return (suma/(cont*1.0)); } int max_of_set(set s){ int max=-1; set::iterator it= s.begin(); while(it!=s.end()){ if(*it>max) max=*it; it++; } return max; } bool mayor(set s1, set s2){ if(s1.empty()) return false; if(s2.empty()) return true; set::iterator it1 = s1.begin(); set::iterator it2 = s2.begin(); while(!s1.empty() && !s2.empty()){ if(max_of_set(s1)> max_of_set(s2)) return true; else if(max_of_set(s1)< max_of_set(s2)) return false; else{ s1.erase(max_of_set(s1)); s2.erase(max_of_set(s2)); } } if(s1.empty() ) return false; return true; } void get_largest_subset(set &S, set &C) { if(S.empty()) return; list> sub_prop; get_sub_prop(S, sub_prop); float prom = promedio(S); float min_dif = 9999999; set rta; for(auto sp: sub_prop){ float aux_prom = promedio(sp); if(fabs(prom-aux_prom)---:---<*>- FINALIZA CODIGO FUNCION --:---<*>---:---<*>---:---<*> int main() { Eval ev; int vrbs=0; ev.eval<1>(get_largest_subset,vrbs); return 0; }