-
Notifications
You must be signed in to change notification settings - Fork 0
/
football.cpp
42 lines (42 loc) · 994 Bytes
/
football.cpp
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
#include<bits/stdc++.h>
using namespace std;
long strtoi(string s) {
long res = 0;
for(int i=0;i<s.length();i++) {
res = res*10 + (s[i]-'0');
}
return res;
}
int main() {
int n;
cin >> n;
map<char, long>team;
vector<int> temp;
for(int i=0;i<n;i++) {
char a, b;
cin >> a >> b;
string score;
cin>> score;
string delimiter = "-";
string score1, score2;
score1 = score.substr(0, score.find(delimiter));
score2 = score.substr(score.find(delimiter)+1, score.size());
long m = strtoi(score1);
long n = strtoi(score2);
team[a]=max(team[a], m);
team[b]=max(team[b], n);
}
int large = INT_MIN;
for(auto x:team) {
if(large < x.second) {
large = x.second;
}
}
for(auto x:team) {
if(large == x.second) {
cout << x.first << endl << x.second << endl;
break;
}
}
return 0;
}