#include<iostream>#include<algorithm>#include<vector>#include<map> #include<string>#include<set>using namespace std;struct rec{ string name;// char gender; string id; int grade; }; vector<rec> boy, girl;bool comp(rec a, rec b){ if(a.grade < b.grade) return true; else return false;}int main(){ int n; cin>>n; for(int i = 0; i < n; i++){ rec a; char gender; cin>>a.name>>gender>>a.id>>a.grade; if(gender == 'M'){ boy.push_back(a); } else{ girl.push_back(a); } } sort(boy.begin(),boy.end(),comp); sort(girl.begin(),girl.end(),comp); int nboy = boy.size(); int ngirl = girl.size(); bool abse = false; if(ngirl == 0){ PRintf("Absent/n"); abse = true; } else{ cout<<girl[ngirl - 1].name<<" "<<girl[ngirl - 1].id<<endl; } if(nboy == 0){ printf("Absent/n"); abse = true; } else{ cout<<boy[0].name<<" "<<boy[0].id<<endl; } if(abse == true){ printf("NA"); } else{ cout<<girl[ngirl - 1].grade - boy[0].grade; } return 0;}
新闻热点
疑难解答