HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Questions 2016 > problem:


15-PE2-4. 50983 - Course Selection

CEN112 Questions 2016

Start: Mar.30.2016 at 03:10:22 PM
Finish: Apr.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 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

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.

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