HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN303_2016Questions > problem:


PE14. 50998 - CEN112 Homework, quiz average

CEN303_2016Questions

Start: Oct.28.2016 at 05:00:00 PM
Finish: Nov.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• HW091. 51061 - The Longest Path
• HW101. 50682 - Hotel Durres
• HW102. 51067 - Jumping frog
• HW111. 50506 - The Biggest Island
• HW112. 50698 - Ayran Delivery
• PE11. 51023 - Preparing Keyword I...
• PE12. 50835 - Club Presidency
• PE13. 51024 - Total Stock Price
• PE14. 50998 - CEN112 Homewo...
• PE21. 51071 - Phalanx-2
• PE22. 51072 - Castle on chessboard
• RE1. 51079 - Key person - 2
• RE2. 51080 - Deepest Point

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.

CEN112 Homework, quiz average

In CEN112, students are offered 5 homework practice exam or quiz in total. But, for the convenience of students, they are required to complete only 4 of them. They may skip any of the Homework or quiz. Or, if they complete all five, the average is calculated out of the best four grades. Note: The average is 0, if the student takes no quiz or homework.

Question: Write a program which reads the grades of n students. Then, the program will show order of the top m students according to the averages. If there are two students with the same average, show first the one whose order is smaller.

Input specification: In the first line, you will be given two integers: the number of students (n), and the number of top (m) students to list. The following n lines contain at most 5 integers ending with a negative number where the grades are between 1 and 100 and 1 ≤ m ≤ n ≤ 10,000.

Output specification: Show m integers (orders of students).

Sample Input
6 3
43 67 61 -1
76 40 76 74 94 -1
74 88 87 92 43 -1
48 88 46 77 -1
41 88 46 81 46 -1
100 100 -1
Sample Output
3 2 5

Explanation: The grades of 6 students are given. Here is the table of averages.

Student # Nr. of Grades Sum of Grades Student Ave
13 17142.75
25 36080
35 38485.25
44 25964.75
55 30265.25
62 20050
So, the third student has the highest average. Then, the second student comes, etc.



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

www.contester.ru