1032 挖掘机技术哪家强
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;bool sortbyscore(pair<int, int> p1, pair<int, int>p2)
{return p1.second > p2.second;
}int main()
{int n = 0;cin >> n;map<int, int> sch;for (int i = 0; i < n; i++){int a, b;cin >> a >> b;sch[a] += b;}vector<pair<int, int>> result;for (auto i = sch.begin(); i !=sch.end(); i++){result.push_back( pair<int, int>(i->first, i->second));}sort(result.begin(), result.end(), sortbyscore);cout << result[0].first << " " << result[0].second;return 0;
}