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

Турниры > CEN112 Homeworks 2013-2015 > задача:


50758 - National Elections - Revisited

CEN112 Homeworks 2013-2015

Старт: 15.дек.2013 в 12:00:00
Финиш: 15.дек.2013 в 17:00:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• 50530 - Sum of Ratios
• 50375 - Area of Circles
• 50388 - Number of Armstrong Num...
• 50393 - Palindromic Numbers
• 50339 - The Largest Rectangle
• 50345 - Orders
• 50758 - National Elections - Re...
• 50754 - Team Standings
• 12-Spr1-40. 50327 - Parallel Lines
• 13-Fall2-20. 50395 - Page "Like" Av...
• 14-Spr1-30. 50492 - Contest Score...
• 14-Spr1-40. 50538 - Sum of kth Dia...
• 14-Spr1-60. 50647 - Спираль
• 14-Spr2-20. 50442 - Polynomial Add...
• 14-Spr2-40. 50361 - Align Two Lists

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

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

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

National Elections - Revisited

Every fourth year national elections is held throughout the country. After voting, people sign the register notebook. And then, to prevent multiple votes, their right hand index finger is dyed with an indelible ink.

This year government wants to change the system to computerized system. After voting the people will be registered to the computer. For this purpose, the lists from different regions are collected in the city center. And full sorted list is going to be prepared for the database.

Question:
Write a program that reads n people information (name, surname, Personal Identification number (PIN)) from two different regions. Then, your program will merge the two lists and sort people information according to PINs in ascending order to produce one big list. Finally, the program will show the k th positioned person's information from the sorted list.

Input specification
The input will have two sections.

  • The list from the first region
  • The list from the second region
The first line of the first region contains two integers (n and k) where n denotes the number of people and k denotes the position of the person to show in the output. Each of the following n lines will have space separated people information:
  • Name: At most 12 chars string containing only English letters.
  • Surname: At most 12 chars string containing only English letters.
  • PIN: 9 digit integer number
After the first list, there will be an integer number (m) and the following m lines will have people information from the second region where 1 ≤ n ≤ 30000; 1 ≤ m ≤ 30000 and 1 ≤ k ≤ 60000.

Output specification
Show kth person's information from the merged and sorted list. (positions start from 1)

Sample Input I   
  6 3
  Rodrigo Chilton 495008016
  Despina Roark 431711128
  Vashti Sutton 358575755
  Kathy Valencia 111493853
  Byron Miller 805827373
  Rodrigo Kinney 436512022
  5
  Shamika Cone 197767850
  Felix Regalado 606171045
  Stuart Pitre 772541445
  Viola Johnston 231606490
  Marcy Fusco 393310572
Sample Output I   
  Viola Johnston 231606490

Output Explanation: Here is the list sorted in ascending order:
  Kathy Valencia 111493853
  Shamika Cone 197767850
  Viola Johnston 231606490
  Vashti Sutton 358575755
  Marcy Fusco 393310572
  Despina Roark 431711128
  Rodrigo Kinney 436512022
  Rodrigo Chilton 495008016
  Felix Regalado 606171045
  Stuart Pitre 772541445
  Byron Miller 805827373
And thus, Viola Johnston is in the 3rd position in the merged and sorted list.


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

www.contester.ru