ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN112 Questions 2016 > задача:


15-FE-4. 50995 - Group Average

CEN112 Questions 2016

Старт: 30.мар.2016 в 15:10:22
Финиш: 01.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 15-FE-1. 50992 - Top K Obese Classes
• 15-FE-2. 50993 - Products in store
• 15-FE-3. 50994 - The Most Crowded...
• 15-FE-4. 50995 - Group Average
• 15-FE-6. 50989 - Rectangles and Points
• 15-FE-7. 50990 - Two Neighbors
• 15-FE-8. 50991 - Intersecting Circles
• 15-HW-2. 50932 - Shifting rows and...
• 15-HW-3. 50933 - Sum of the Bigges...
• 15-HW-4. 50934 - Selling Cars
• 15-HW-5. 50935 - Max Discount
• 15-MdtE-1. 50915 - Trip to Korca

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Group Average

Question: In a file you have the number of questions solved by students from different groups. Write a program that calculates the average of all groups and sorts them in descending according to the averages. If there are two groups with the same average show them in ascending order according to the group names.

Input specification: At the beginning, you will be given two integers: the number of students (n) and the number of top m groups to list. Then in the following n lines, you will be given two information: the group of the student (grp) and the number of questions solved (k) by this student, where

  • grp is a string with at most 10 chars
  • k is a positive integer not greater than 10,000
and 1 ≤ m ≤ n ≤ 10,000.

Output specification: Show top m groups.

Sample Input
6 2
CEN1 20
CEN1 28
CEN2 10
ECE1 21
CEN2 10
ECE1 19
Sample Output
CEN1
ECE1

Explanation: The average of

  • CEN1 is 24,
  • ECE1 is 20, and
  • CEN2 is 10.
Thus, the top two groups are CEN1 and ECE1.



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

www.contester.ru