#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<iomanip>
#include<algorithm>
using namespace std;

struct Student
{
	char chName[15];
	char chId[15];
	int iScore;
};

bool lessCmp(Student stu1, Student stu2)
{
	return stu1.iScore < stu2.iScore;
}

bool greaterCmp(Student stu1, Student stu2)
{
	return stu1.iScore > stu2.iScore;
}

int main()
{
	vector<Student> vBoys,vGirls;
	int N,i;
	char cGender;
	Student stuTmp;
	cin>>N;
	for(i=0; i<N; i++)
	{
		cin>>stuTmp.chName>>cGender>>stuTmp.chId>>stuTmp.iScore;
		if(cGender == 'M')
			vBoys.push_back(stuTmp);
		else
			vGirls.push_back(stuTmp);
	}
	if(vGirls.size() == 0)
		cout<<"Absent"<<endl;
	else
	{
		sort(vGirls.begin(),vGirls.end(),greaterCmp);
		cout<<vGirls[0].chName<<" "<<vGirls[0].chId<<endl;
	}
	if(vBoys.size() == 0)
		cout<<"Absent"<<endl;
	else
	{
		sort(vBoys.begin(),vBoys.end(),lessCmp);
		cout<<vBoys[0].chName<<" "<<vBoys[0].chId<<endl;
	}
	if(vGirls.size() == 0 || vBoys.size() == 0)
		cout<<"NA"<<endl;
	else
		cout<<vGirls[0].iScore-vBoys[0].iScore<<endl;
	return 0;
}

  

相关文章:

  • 2022-12-23
  • 2021-12-01
  • 2021-11-14
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2020-06-02
  • 2021-06-07
  • 2021-08-08
  • 2021-12-26
相关资源
相似解决方案