2005' ACM/ICPC Asia Preliminary Internet Chengdu Site
H: Search Strategy
DescriptionYou must have enjoyed the convenience that web search engines brought to you, but have you ever attempted to build your own search engine? Now it's the time.
XXXX should be replaced with domain name, which is a combination of digits and/or alphabets, e.g. www.test.com. Notice that a website can have multiple level (less than 5) of sub domains, sub domain name should also follow the rule of domain name, e.g. search.test.com, which is a second level domain of www.test.com, hyperlinks can link to URL of either domain or files in domain with HTTP protocol, e.g.: http://www.test.com and http://search.test.com/index.php, are both hyperlinks pointing to the same website. In some URLs, the protocol prefix is neglected. Of course, URLs and keywords are not case sensitive. InputThere is only one test case in the input, which begins with a number n, denoting number of web pages collected by crawler. Subsequently n pages are detailed; each page begins with a single line printed "URL:" and its URL, then a number w, tells how many keywords in the page. Keywords are separated by white spaces. Followed is a number r, denotes the number of hyperlinks in the page. Then hyperlinks are given, each occupies a single line. After all pages are given, there is a number k, means k keywords are to be searched, then keywords are printed separate by white spaces. OutputFor each keyword, you should first output a single line: "Search results of keyword ", followed by the keyword and a ":" (colon). Then the URLs of ranked results pages containing the keyword are outputted, each URL occupies a single line. Results of different keywords should be separated by a blank line. Sample Input
2 URL:http://news.yahoo.com/acm 1 acm 1 http://news.acmer.com URL:http://www.acmer.com/index.html 2 problem acm 0 1 acm Sample Output
Search results of keyword acm: http://www.acmer.com/index.html http://news.yahoo.com/acm |
评论