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

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


51000 - Book Index

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

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

• 50386 - Conformity
• 50796 - KNN
• 51000 - Book Index
• 50985 - Books Waiting
• 50995 - Group Average
• 50517 - Confusion Matrix
• 50789 - Number of Cities
• 50983 - Course Selection
• 51024 - Total Stock Price
• 50987 - Very Looong Queue
• 50993 - Products in store

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

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

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

Book Index

Question: The books have indexes at the end, so that, people can search for a specific topic or section using a keyword. You are given the index pages with keywords. Then, you are asked to prepare the index of the book. Write a program which reads the page and keyword information. Then, the program should prepare the index for the book.

Input specification: In the first line, you will be given an integer: the number of pages (n) with keywords. The following n lines start with two integers the page number (p) and the number of keywords (k) in that page where keywords are all in lowercase and contain only 26 English letters with no special char. Then, you will be given k keywords in the same line. where 1 ≤ n ≤ 10,000 and there may at most 100 keywords in one page.

Output specification: Show each keyword in a line. Keywords will be in alphabetical order followed by the page numbers (in ascending order) that they appear.

Sample Input
4
1 2 book index
4 1 keyword
5 3 index keyword search
7 3 index search appear

Sample Output
appear 7
book 1
index 1 5 7
keyword 4 5
search 5 7

Explanation: There are four pages with keywords given. The first page contains 2 keywords: book and index. There are 5 keywords in total and the keyword "book" appears only in page 1.



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

www.contester.ru