HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN303 2013-15 Questions > problem:


51000 - Book Index

CEN303 2013-15 Questions

Start: Dec.15.2013 at 02:00:00 PM
Finish: Dec.15.2013 at 07:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 50472 - Minimum Sum Triangle
• 50842 - Minimum Sum Triangle - DP
• 50319 - Toll Plazas
• 51000 - Book Index
• 50531 - File Decryption
• 50464 - From Tirana to Durres
• 13-Fall2-10. 50411 - Sum of the Lea...
• 13-Fall2-20. 50687 - Pascal Triangle - 2
• 13-Fall2-40. 50753 - Average of the...
• 13-Fall2-50. 50686 - The Container
• 14-Fall1-10. 50740 - Service Time - 1
• 14-Fall1-20. 50750 - Service Time - 2

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.

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