#include "stdafx.h"
#include<iostream>
#include<vector>
#include<map>
#include<utility>
using namespace std;
int main()
{
map<int, vector<int>> info;
int n = 0;
int number = 0;
int grade = 0;
cin >> n;
for (int i = 0; i < n; ++i)
{
cin >> number >> grade;
info[number].push_back(grade);
}
int good_grades = 0;
pair<int, vector<int>> good_school;
for (auto &r : info)
{
int sum = 0;
for (auto &k : r.second)
{
sum = sum + k;
}
if (sum > good_grades)
{
good_grades = sum;
good_school = r;
}
}
cout << good_school.first << " " << good_grades;
return 0;
}
网友评论