HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


210. 50361 - Align Two Lists

Guest
• Review clarifications (2)

Volume problems

• 155. 50726 - Pascal Triangle - 1
• 160. 50301 - Fractions to Decimals
• 165. 50360 - National Elections
• 170. 50319 - Toll Plazas
• 180. 50755- Top N Donors - 1
• 185. 50784 - Top Growing Company
• 190. 50734 - Product Info (In Srt)
• 200. 50290 - Minimax Sum
• 210. 50361 - Align Two Lists
• 220. 50754 - Team Standings
• 230. 50286 - Remove Duplicates
• 250. 50448 - Paint Buckets
• 280. 50477 - Character Pyramids

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