-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1036.cpp
More file actions
33 lines (32 loc) · 688 Bytes
/
1036.cpp
File metadata and controls
33 lines (32 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
string Mname, Mid, Fname, Fid, tname, tid;
int Mscore = 101, Fscore = -1, tscore, n;
char gender;
cin>>n;
for(int i=0; i<n; i++){
cin>>tname>>gender>>tid>>tscore;
if(gender == 'M'){
if(tscore < Mscore){
Mscore = tscore;
Mname = tname;
Mid = tid;
}
}else{
if(tscore > Fscore){
Fscore = tscore;
Fname = tname;
Fid = tid;
}
}
}
if(Fname == "") cout<<"Absent\n";
else cout<<Fname<<' '<<Fid<<endl;
if(Mname == "") cout<<"Absent\n";
else cout<<Mname<<' '<<Mid<<endl;
if(Mname == "" || Fname == "") cout<<"NA";
else cout<<Fscore-Mscore;
return 0;
}