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

Сборники > Kovrov IT > задача:


50746 - Most Visited

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

Задачи сборника

• 50977 - Gaussian Elimination
• Raporti Javor
• 50657 - Permutations and Combinat...
• 51246 - Swap largest word, reverse ...
• 50748 - Gold Store
• 50766 - Word Puzzle
• 50658 - The Message
• 50934 - Selling Cars
• 50746 - Most Visited
• 50749 - Min Distance
• 50915 - Trip to Korca
• 50985 - Books Waiting
• 50927 - Health Expenses
• 50983 - Course Selection
• 50745 - Bitonic Sequence
• 50789 - Number of Cities
• 50987 - Very Looong Queue

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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