#include<stdio.h>
#include<map>
using namespace std;
int main()
{
map<int, int> mp;
int N, t, p, score;
scanf("%d", &N);
while(N--)
{
scanf("%d-%d%d", &t, &p, &score);
mp[t] += score;//用map建立队伍编号与成绩的映射
}
int ans, k = -1;
for(map<int, int>::iterator it = mp.begin(); it != mp.end(); it ++)
{//对每一组队伍进行遍历
if(it -> second > k){
k = it -> second;
ans = it -> first;//更新
}
}
printf("%d %d\n", ans, k);
return 0;
}
用map映射比数组遍历的次数更少!!!