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

Разделы > Переборные задачи > задача:


50828 - Arranging Time Table

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

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

• 50709 - k-ary Strings
• 50708 - Binary Strings
• 50996 - Checkers - the shortest path
• 51067 - Jumping frog
• Post Office Delivery
• 50840 - Tanker trucks
• 51142 - Jump Min Value
• 50490 - Across the River
• 50828 - Arranging Time Table
• 51082 - Sum is equal to K - 1
• 50506 - The Biggest Island
• 50718 - Elevator
• 50472 - Minimum Sum Triangle
• 50593 - Transportimi
• 50711 - Snail Trails
• 50306 - Beautiful Numbers
• 50720 - Перестановки (2)

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

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

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

Arranging Time Table

You have started working in North West Tirana high school. And, you have to arrange the time tables. There are classrooms with different sizes and several different student classes with different number of students. A student class may be assigned to a classroom, if the number of students in the class is less than or equal to the classroom capacity. For example, if there are 25 students in a class, it can be assigned to classroom with the capacity 27, but it can not be assigned to a classroom with the capacity 24.

Question: Write a program that is going to get information for n classrooms and k student classes. And then, it will show the possible placements.

Input specification
In the first line, you will be given two integers: The number of classrooms(n) and the number of student classes(k), where 0 ≤ k ≤ n ≤ 15. In the following line, you will be given n integers: the capacities of n classrooms. And in the following line, you will be given k integers: number of students in k classes.

Output specification:
In the first line, show total number of possible classroom arrangements (nRes). Then in the following nRes lines, show nr of students and classroom capacity pairs such that all student classes are assigned to classrooms where every pair is followed by a semicolon. If there is no possible placement, you print 0.
Note: There is no result (nRes) greater than 5,000.

Sample Input I
4 3
24 50 30 55
50 30 25
Sample Output I
4
50 50; 30 30; 25 55;
50 50; 25 30; 30 55;
30 50; 25 30; 50 55;
25 50; 30 30; 50 55;

Explanation: There are 4 possible arrangements.

  1. Class with 52 students can be assigned to classroom with the capacity 55
  2. Class with 25 students can be assigned to classroom with the capacity 50
  3. Class with 30 students can be assigned to classroom with the capacity 30
And, there are 3 other class to classroom arrangements.



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

www.contester.ru