A. Room leader

Source: Internet
Author: User
Time limit per test

2 seconds

Memory limit per test

256 megabytes

Input

Standard Input

Output

Standard output

Let us remind you part of the rules of codeforces. The given rules slightly simplified, use the problem statement as a formal document.

In the beginning of the round the contestants are divided into rooms. Each room contains exactlyNParticipant. During the contest the participant
Are suggested to solve five problems,A,B,C,DAndE.
For each of these problem, depending on when the given problem was solved and whether it was solved at all, the participates ipants receive some points. besides, a contestant can perform hacks on other contestants. for each successful hack a contestant earns 100 points,
For each unsuccessful hack a contestant loses 50 points. The number of points for every contestant is represented by the sum of points he has defined ed
From all his problems, including hacks.

You are suggested to determine the leader for some room; the leader is a participant who has maximum points.

Input

The first line contains an integerN, Which is the number of contestants in the room (1 hour ≤ secondNLimit ≤ limit 50 ).
The nextNLines contain the maid of a given room.I-Th
Line has the format"HandleI PlusI MinusI AI BI CI DI EI"
-It is the handle of a contestant, the number of successful hacks, the number of unsuccessful hacks and the number of points he has stored ed from problemsA,B,C,D,ECorrespondingly.
The handle of each participant ipant consists of Latin letters, digits and underscores and has the length from 1 to 20 characters.
There are the following limitations imposed upon the numbers:

  • 0 bytes ≤ bytesPlusI, Bytes,MinusILimit ≤ limit 50;
  • 150 limit ≤ limitAILimit ≤ limit 500 orAILimit = Limit 0,
    If ProblemAIs not solved;
  • 300 limit ≤ limitBILimit ≤ limit 1000 orBILimit = Limit 0,
    If ProblemBIs not solved;
  • 450 limit ≤ limitCILimit ≤ limit 1500 orCILimit = Limit 0,
    If ProblemCIs not solved;
  • 600 limit ≤ limitDILimit ≤ limit 2000 orDILimit = Limit 0,
    If ProblemDIs not solved;
  • 750 limit ≤ limitEILimit ≤ limit 2500 orEILimit = Limit 0,
    If ProblemEIs not solved.

All the numbers are integer. all the participants have different handles. it is guaranteed that there is exactly one leader in the room (I. e. there are no two maid with the maximal number of points ).

Output

Print on the single line the handle of the room leader.

Sample test (s) Input
5Petr 3 1 490 920 1000 1200 0tourist 2 0 490 950 1100 1400 0Egor 7 0 480 900 950 0 1000c00lH4x0R 0 10 150 0 0 0 0some_participant 2 1 450 720 900 0 0
Output
tourist
Note

The number of points that each participant ipant from the example earns, are as follows:

  • Petr-1, 3860
  • Tour ist-4140
  • Egor-4030
  • C00lh4x0r-release-limit 350
  • Some_participant ipant-2220

Thus, the leader of the room is tourist.

Explanation: This question requires that the player with the highest score be obtained. Multiply the hack value by 100 minus the unhack value by 50 plus the score of the next five questions.

#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <cstring>#include <string>#include <algorithm>using namespace std;int main(){int n,i,q,a,b,c,d,e,l,x,y;string s,t;cin>>n;for(i=1;i<=n;i++){cin>>s>>x>>y>>a>>b>>c>>d>>e;l=x*100-y*50+a+b+c+d+e;if(l>q || i==1) {q=l;t=s;}}cout<<t<<endl;return 0;}

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.