本题数组排序,用map来记录
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
int main()
{
int n,x,y;
map<int,int> m;
//freopen("1032.txt","r",stdin);
scanf("%d",&n);
int a[n];
memset(a,0,sizeof(a));
int maxn=0;
for(int i=0;i<n;i++)
{
scanf("%d %d",&x,&y);
a[x-1]+=y;
if(x>maxn)
maxn=x;
}
for(int i=0;i<maxn;i++)
{
m[a[i]]=i;
}
sort(a,a+maxn);
//printf("%d\n",len);
printf("%d %d",m[a[maxn-1]]+1,a[maxn-1]);
return 0;
}