HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Homeworks 2013-2015 > problem:


14-Spr2-40. 50361 - Align Two Lists

CEN112 Homeworks 2013-2015

Start: Dec.15.2013 at 12:00:00 PM
Finish: Dec.15.2013 at 05:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 50758 - National Elections - Revisited
• 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 - Spiral
• 14-Spr2-20. 50442 - Polynomial Add...
• 14-Spr2-40. 50361 - Align Two ...
• 14-Spr2-50. 50616 - Snake
• 14-Spr2-60. 50444 - n digit kth nu...
• 15-SprHW-20. 50446 - Snake
• 15-SprHW-30. 50788 - Eight Puzzle
• 15-SprHW-40. 50746 - Most Visited
• 15-SprHW-60. 50516 - Lines
• 15-SprPr2-20. 50509 - Reading Book
• 15-SprPr2-60. 50766 - Word Puzzle

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