1029: Excavator technology which strong time limit: 1 Sec memory limit: ( MB)
Submitted by : Solve: 197
Submitted State [Discussion Version] Title Description
In order to use the fact that the excavator technology in the end which strong, organized an excavator skills contest. You are now asked to count the most technically powerful schools according to the results of the match.
Input
The input gives a positive integer n of no more than 105 in line 1th, which is the number of participants. Then n rows, each row gives a contestant's information and results, including the number of the school they represent (consecutively numbered from 1), and their race results (percentile), separated by a space.
Output
Give the number of the school with the highest score in a row, and its total score, separated by a space. The title ensures that the answer is unique and not tied.
Sample input
63 652 801 1002 703 403 0
Sample output
2 150
Hint Source
2001289
#include <iostream>
using namespace Std;
int main () {
int n,i,id,score,a[100001]={0};
int Index,max;
cin>>n;
for (i=0;i<n;i++) {
cin>>id>>score;
A[id]=a[id]+score;
}
MAX=A[0];
index=0;
for (i=1;i<100001;i++) {
if (A[i]>max) {
Max=a[i];
Index=i;
}
}
cout<<index<< "" <<max<<endl;
return 0;
}
1029: Excavator technology which strong