×

# week day problem.

 0 An educational institute developed a educational program. It offers several courses and students are required to take a certain number of these courses. Each course publishes its schedule of lectures on a day-wise basis, i.e., it publishes the days of the week on which it holds lectures. Each course chooses exactly three days of the week for lectures. Travelling to the institute is a nuisance and all the students who attend courses there, seek to minimise the number of days that they should have to travel. Given each course's schedule, you have to help the students decide on a combination of courses, such that they minimise the number of days that they have to travel to the institute. The institute has strict attendance norms and it insists that students should attend all the lectures that their respective course offers. Assume that the number of courses required will never be greater than the number of courses offered. In addition, there will be a unique combination of days, which allows the students to take the required number of courses and minimise travel. Input specification: First line will contain total number of courses (T) and the number of courses you are required to register (R) for. The next T lines will each contain name of the course and those days on which the lectures for the course are held. The first word on each line is the name of the course and the rest of the words are three-letter words signifying the days of the week. E.g., "OOPJ MON WED FRI". Output specification: You should output the names of the days on which the student is required to go to the institute to attend lectures. These should be printed on a single line in sorted order (SUN to SAT) with a single whitespace as a separator. Terminate the output with a newline. Sample Input and Output: Input: 6 3 OOPJ MON WED TUE DSAL TUE WED THU PCCP WED SAT THU COOS MON FRI WED DBMS TUE WED FRI CNET MON THU FRI Output: MON TUE WED FRI Input: 6 2 OOPJ SUN TUE WED DSAL TUE WED THU PCCP THU WED FRI COOS MON WED FRI DBMS THU TUE WED CNET FRI MON THU Output: TUE WED THU asked 17 Nov '14, 16:23 2★sorbhs 1 accept rate: 0%

 0 Probably I missed the question... answered 17 Nov '14, 16:26 16.9k●49●115●225 accept rate: 11% do you have any idea? (17 Nov '14, 16:40) sorbhs2★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×690

question asked: 17 Nov '14, 16:23

question was seen: 853 times

last updated: 17 Nov '14, 16:40