HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Homeworks 2013-2015 > problem:


15-SprHW-40. 50746 - Most Visited

CEN112 Homeworks 2013-2015

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

Guest
• Review clarifications (1)

Contest problems

• 14-Spr1-40. 50538 - Sum of kth Dia...
• 14-Spr1-60. 50647 - Spiral
• 14-Spr2-20. 50442 - Polynomial Add...
• 14-Spr2-40. 50361 - Align Two Lists
• 14-Spr2-50. 50616 - Snake
• 14-Spr2-60. 50444 - n digit kth nu...
• 15-SprHW-20. 50446 - Snake
• 15-SprHW-30. 50788 - Eight Puzzle
• 15-SprHW-40. 50746 - Most Visited
• 15-SprHW-60. 50516 - Lines
• 15-SprPr2-20. 50509 - Reading Book
• 15-SprPr2-60. 50766 - Word Puzzle
• 15-SprPr2-80. 50786 - Top Question
• 15-SprPrE1-20. 50785 - Swimming ...
• 15-SprPrE1-40. 50748 - Gold Store
• 15-SprPrE1-70. 50507 - Sequential ...
• 15-SprResit-20. 50447 - Swimming ...

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.

Most Visited

You start working on a company and you are administering the website. The boss is frequently asking information for the site. He is following daily visits, most visited pages etc. He wants you to prepare something that helps him. Every page has an ID, name and some content. Whenever a pages is clicked, page ID is sent to the server. And in the server there are some scripts that increments the counter for that page.

Question: You will be given the name and id of n web pages. Then you will be given a series of page IDs. You need to figure out the most visited page. Note: Pay attention that there are also hackers trying to break your system and there are several fake page IDs.

Input specification
You will be first given two integers: the number of web pages (n) and the number of pageviews (m) where 1 ≤ n ≤ 10,000 and 1 ≤ m ≤ 20,000. Then in the following n lines you will be given the information for n web pages. Every line contains:

  • webpage ID: a unique integer which is between 1 and 200,000.
  • Webpage name: a string which contains any ASCII char and there are at most 100 chars
After that, you will be given m numbers in several lines (25 numbers per line). Each number is between 0 and 2e9

Output specification
Show two information:

  • The number number of fake pageviews
  • The name of the most visited page
If there are several pages with the same number of most visits, show the one with the smaller ID.

Sample Input I
5 12
2 Main Site
5 Login page
3 Administration login page
7 Contacts & maps
6 Forum and Discussions
6 4 5 5 6 5 1 3 6 3 7 1
Sample Output I
3
Login Page

Explanation: There are 5 webpages and 12 pageviews. There are 3 fake pageviews: two 1s and a 4. Pages with the ID 5 and 6 have 3 pageviews. So, Login page is the first top visited webpage.



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

www.contester.ru