HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > SEM 2 - W6 > problem:


50757 - National Elections - 1

SEM 2 - W6

Start: Apr.11.2023 at 04:57:14 PM
Finish: Apr.17.2023 at 08:57:14 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 50364 - Student averages
• 50757 - National Elections - 1
• 50755- Top N Donors - 1
• 13-Fall2-60. 50756 - Average of the...

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.

National Elections - 1

Every fourth year, national elections are 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 ≤ 5,000; 1 ≤ m ≤ 5,000 and 1 ≤ k ≤ 10,000.

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