#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
class cstudent
{
public:
string name,id;
int score;
bool operator< (const cstudent & st) const
{
return score<st.score;
}
};
class CA
{
public:
void run();
int n;
vector<cstudent> mlist,flist;
};
void CA::run()
{
cin>>n;
cstudent st;
vector<cstudent>::iterator imv,ifv;
char fm;
while(n-->0)
{
cin>>st.name>>fm>>st.id>>st.score;
if(fm=='M') mlist.push_back(st);
else if(fm=='F') flist.push_back(st);
}
ifv=max_element(flist.begin(),flist.end());
imv=min_element(mlist.begin(),mlist.end());
if(ifv!=flist.end())
{
cout<<ifv->name<<" "<<ifv->id<<endl;
}
else
{
cout<<"Absent"<<endl;
}
if(imv!=mlist.end())
{
cout<<imv->name<<" "<<imv->id<<endl;
}
else
{
cout<<"Absent"<<endl;
}
if(ifv!=flist.end()&&imv!=mlist.end())
{
cout<<ifv->score-imv->score<<endl;
}
else
{
cout<<"NA"<<endl;
}
}
int main()
{
// freopen("test.in","r",stdin);
CA *a=new CA;
a->run();
return 0;
}
1036. Boys vs Girls (25)
最新推荐文章于 2022-05-29 20:02:17 发布