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

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


50983 - Course Selection

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

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

• 50386 - Conformity
• 50796 - KNN
• 50795 - Trunk
• 50985 - Books Waiting
• 50995 - Group Average
• 50983 - Course Selection
• 50517 - Confusion Matrix
• 50789 - Number of Cities
• 50993 - Products in store
• 50987 - Very Looong Queue
• 50869 - Birthday Celebration
• 50981 - Top popular m-students
• 50794 - Writing Files Into HDD
• 51000 - Book Index

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

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

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

Course Selection

Question: At the university, there are many courses for students. The courses have quotas and the students are able to choose courses if there is a sit in the course. Write a program that reads course selection list of n students, and then, list top m courses according to the number of students chosen.

Input specification
You will be given three integers in the beginning:

  • The number of students (n): an integer not greater than 20,000.
  • The quota for the courses (m): not more than m students can join to the courses
  • The number of courses to list (k): list top k courses.
Then, the following n lines starts with an integer, (k) the number of preferences of this student. Then, you will be given k course codes which are at most 8 char long alphanumeric text. The order of students defines the course selection. The first student has the highest priority for course selection. etc. Next student can join to a course, if not m students before him have selected the respected course.

Output specification:
Show the top k courses in descending order according to the number of students selected. If the two courses were selected with the same number of students, first show the course which is alphabetically smaller.

Sample Input
5 3 2
2 CEN103 CEN112
2 CEN111 CEN112
3 CEN103 CEN111 CEN211
2 CEN111 CEN211
3 CEN103 CEN111 CEN112
Sample Output
CEN103
CEN111

Explanation: There are 5 students. All the courses have the quota of 3 (each course can be chosen by at most 3 students). Then, list top 2 courses.

Course Code Number of students applied
CEN103 3
CEN111 4
CEN112 3
CEN211 2
But, because the max quota is 3, CEN111 can be selected by at most 3 students. Then, top two courses according to the alphabetic order CEN103, CEN111.



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

www.contester.ru