Go for Gold
Practice
0 (0 votes)
Easy
Problem
39% Success 320 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Dr.Sankey wants to form 2-member teams for future programming contests in his university which has $$N$$ students. Each student has a skill value and the total power of a team is half of the sum of skill values of the team members. He forms teams in such a manner: The 1st and 2nd highest skilled students form a team together, the 3rd and 4th highest skilled form a team together and so on. Each student would be a part of some team i.e; $$N$$/2 teams are made.

Find the average power of the teams in Dr.Sankey's university.

Input Format:

First line contains the integer $$N$$. Next line contains $$N$$ integers, each denoting the skill value of ith student.

Output Format:

Output one integer which is a floored value of the floating number denoting the average power of teams in the college.

Constraints:

1 <= $$N$$ <= 106

1 <= Ai <= 1017

$$N$$ is always even 

All Necessary Calculation to find out the required answer can be done using a 64-bit integer.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
12 votes
Tags:
Applications of Dynamic ProgrammingAlgorithmsMathDynamic Programming
Points:20
Tags:
Dynamic Programming
Points:20
1 votes
Tags:
Easy
Editorial

No editorial available for this problem.