1029: Excavator technology which strong

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.