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

Разделы > Non-linear Data structures: Map, Set, Priority Queues > задача:


50995 - Group Average

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

Задачи раздела

• 50386 - Conformity
• 50796 - KNN
• 51000 - Book Index
• 50985 - Books Waiting
• 50995 - Group Average
• 50517 - Confusion Matrix
• 50789 - Number of Cities
• 50983 - Course Selection
• 51024 - Total Stock Price
• 50987 - Very Looong Queue
• 50993 - Products in store
• 50869 - Birthday Celebration
• 50981 - Top popular m-students

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

Если у вас есть предложения или пожелания по работе 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