SEM 2 - W6 |
Старт: 11.апр.2023 в 16:57:14
Финиш: 17.апр.2023 в 20:57:14
Турнир завершён!
• Турнирная таблица
|
|
Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. 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.
Для отправки решений необходимо выполнить вход.
|