-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpat-1036.cpp
More file actions
56 lines (45 loc) · 764 Bytes
/
Copy pathpat-1036.cpp
File metadata and controls
56 lines (45 loc) · 764 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
int n; cin >> n;
string m1, m3;
char m2;
int m4;
string low_name, high_name, lows, highs;
int low = 101, high = -1;
for (int i = 0; i < n; i++)
{
cin >> m1 >> m2 >> m3 >> m4;
if (m2 == 'M')
{
if (m4 < low)
{
low = m4;
low_name = m1;
lows = m3;
}
}
else
{
if (m4 > high)
{
high = m4;
high_name = m1;
highs = m3;
}
}
}
if (high == -1)
cout << "Absent" << endl;
else cout << high_name << ' ' << highs << endl;
if (low == 101)
cout << "Absent" << endl;
else cout << low_name << ' ' << lows << endl;
if (low == 101 || high == -1)
cout << "NA" << endl;
else
cout << high - low << endl;
}