HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN111 Homeworks 2013-2015 > problem:


15-FallHW-5. 50824 - Sum of Group Maxes

CEN111 Homeworks 2013-2015

Start: Jan.10.2015 at 10:00:00 AM
Finish: Jan.10.2015 at 03:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 14-FallResit-20. 50407 - Missing Nu...
• 14-Spr2-10. 50426 - Calculating Sales
• 14-Spr2-20. 50425 - Calculating W...
• 14-Spr2-30. 50445 - Cryptography
• 14-Spr2-50. 50437 - Age Labeling
• 15-FallHW-2. 50821 - Derivative of ...
• 15-FallHW-3. 50822 - Linked List
• 15-FallHW-4. 50823 - Secret Number
• 15-FallHW-5. 50824 - Sum of Gr...
• 15-FallHW-6. 50825 - Drawing Polygon
• 15-FallPr-10. 50808 - Total Distance...
• 15-FallPr-50. 50812 - Total Discount...
• 15-FallPr-70. 50814 - Buying Books f...
• 15-FallPr-80. 50815 - Breaking the ...
• 15-FallRE-10. 50853 - Parking Place
• 15-FallRE-20. 50854 - Area of Trian...

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