HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


50824 - Sum of Group Maxes

Guest
• Review clarifications (1)

Section problems

• 50853 - Parking Place
• 50496 - Falling Bricks
• 50876 - He is my cousin
• 50829 - Decode an Image
• 50851 - Repeated Numbers
• 50838 - Balanced Numbers
• 50515 - Lines - Revisited
• 50913 - Manhattan Distance
• 50824 - Sum of Group Maxes
• 50449 - The biggest result
• 50442 - Polynomial Addition
• 50982 - A thief in labyrinth
• 50989 - Rectangles and Points
• 50932 - Shifting rows and columns
• 50497 - Falling Bricks - Revisited
• 50933 - Sum of the Biggest Neighbors
• 50444 - n digit kth number divisible...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Sum of Group Maxes

There is a competition in your brother's school. The students form groups of k-students. Then, every student jth in the group competes with the jth of other groups.

Question: Write a program that is going to get information for n students and it finds the sum of group maxes.

Input specification
In the first line, you will be given two integers: The number of students(n) and the number of students in every group (k) where 0 ≤ k ≤ n ≤ 10,000. Then, starting from the next line, you will be given n integers where the numbers are between -2e5 and 2e5.

Output specification:
Show one integer: sum of group maxes.

Sample Input I
8 3
10 0 5 7 0 5 9 7
Sample Output I
22

Explanation: First students the groups are 10, 7 and 9. So, the max of first students is 10. Then the maxes of every jth students are 10 7 and 5. And the sum is 22.



Для отправки решений необходимо выполнить вход.

www.contester.ru