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

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


15-PE2-4. 50983 - Course Selection

CEN112 Questions 2016

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

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

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

• 15-PE-5. 50869 - Birthday Celebration
• 15-PE-7. 50871 - Harmonic Mean
• 15-PE-8. 50872 - Top M Grades
• 15-PE2-1. 50980 - The smallest rect...
• 15-PE2-2. 50981 - Top popular m-st...
• 15-PE2-2. 50984 - Top m hardworki...
• 15-PE2-2. 51086 - Top popular student
• 15-PE2-3. 50982 - A thief in labyrinth
• 15-PE2-4. 50983 - Course Select...
• 15-PE2-6. 50985 - Books Waiting
• 15-PE2-8. 50987 - Very Looong Queue
• 15-RE-2. 50999 - Overlapping Trips
• 3. 51002 - The most successful classes
• 4. 51003 - Double Prime
• HW092. 51081 - Fish Pond I
• HW092. 51062 - Fish Pond II

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

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