#include<iostream> #include<sstream> #include<cstdlib> #include<cstdio> #include<map> #include<cstring> #include<algorithm> #include<vector> #include<limits> #include<set> #define db(a) cout << #a << " = " << a << endl; #define db2(a, b) cout << #a << " = " << a << " -- "<< #b << " = " << b << endl; #define foreach(it, l) for(typeof(l.begin()) it = l.begin(); it != l.end(); it++) using namespace std; int main(){ double compliance, min_price; int p, n, num_met; string linea, name_aux, name; double min_price_aux; int cont = 0; while(scanf("%d%d\n", &n , &p)){ if(n == 0 && p == 0) break; min_price = numeric_limits::max(); compliance = 0.; if (cont != 0)printf("\n"); for(int k = 0; k < n; k++) getline(cin, linea, '\n'); for(int t = 0; t < p; t++){ getline(cin, name_aux, '\n'); scanf("%lf%d\n",&min_price_aux, &num_met); for(int k = 0; k < num_met; k++)getline(cin, linea, '\n'); if(num_met > compliance){ compliance = num_met; min_price = min_price_aux; name = name_aux; } else{ if(num_met == compliance && min_price_aux < min_price){ min_price = min_price_aux; name = name_aux; } } } printf("RFP #%d\n%s\n", ++cont,name.c_str()); } return 0; }
lunes, 24 de octubre de 2011
10141 - Request for Proposal, uva
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario