HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Sorting and sequences > problem:


50361 - Align Two Lists

Guest
• Review clarifications (2)

Section problems

• 50835 - Club Presidency
• 50747 - Safe boxes against thieves
• 50742 - King Arthur II
• 50352 - Selling Cows
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• 50912 - Trip to Librazhd
• Trip to Librazhd
• 50361 - Align Two Lists
• 50914 - Buy 3, Pay 2

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, First used in IMPC-13 Nov.

Align one list to another

There are two student lists (listA and listB). listA contains (stID, stName, stPhone), listB contains stID and 3 grades for 3 courses (stID, CEN111, CEN112, CEN100).

Question: Write a program that reads two lists and aligns listB to listA such that if listB has the same ID the grades will be shown at the end listA, nothing otherwise.

Input specification
You will be first given two numbers (m and n) the sizes of listA and listB where 1 ≤ (m and n) ≤ 10000. Then in the following m lines, you will be given listA. That is going to be follewed by n lines of listB information.

Student names and surnames are at most 12 char strings, student averages are integer between 1 and 100 and stID is interger 1 and You will be first given a number (n) the number of numbers where 1 ≤ n ≤ 10000. Then you will be given n space separated numbers (nums[n]) where each of the number in the series is 1 ≤ nums[i] ≤ 10000.

Output specification
Show merged information (stIDs, and 3 grades) aligned to the end of first list (listA) (one student info per line).

Sample Input I
  6 7
  2 Jason Brown 0679512521
  4 Karla Haynes 0688380696
  6 Debbie Garrett 0692462907
  9 Benjamin Hawkins 0675361541
  11 Cassandra Walker 0676451995
  13 Eunice Robbins 0690534131
  3 50 74 30
  4 62 13 32
  6 62 78 92
  8 56 80 28
  10 99 37 69
  11 83 12 15
  15 72 17 44

Sample Output I
  2
  4 62 13 32
  6 62 78 92
  9
  11 83 12 15
  13


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

www.contester.ru