代码实现:
#include<stdio.h>
#define X 100000
int main()
{
int school[X], N,max_index=0;
scanf("%d", &N);
for (int i = 0; i < X; i++)school[i] = 0;
for (int i = 0; i < N; i++)
{
int num, score;
scanf("%d %d", &num, &score);
school[num] += score;
}
for (int i = 0; i < X; i++)
if (school[i] > school[max_index])max_index = i;
printf("%d %d", max_index, school[max_index]);
return 0;
}