#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin>>N;
int a[N][3];
for(int i=0;i<N;i++){
scanf("%d-%d %d",&a[i][0],&a[i][1],&a[i][2]);
}
map<int ,int>m;
for(int i=0;i<N;i++){
if(m[a[i][0]]==0){
m[a[i][0]]+=a[i][2];
}else{
m[a[i][0]]+=a[i][2];
}
}
int maxScore = -1;
int championTeam = -1;
for(auto it = m.begin(); it != m.end(); ++it){
if(it->second > maxScore){
maxScore = it->second;
championTeam = it->first;
}
}
cout<<championTeam<<" "<<maxScore<<endl;
return 0;
}
迭代器的使用要尤其注意。