1032


#include "stdafx.h"

#include
#include
#include
#include

using namespace std;



int main()
{


    map> 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> 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;
}

你可能感兴趣的:(1032)