HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51143 - Departments Competition

Section problems

• 51073 - Campus Tours for High Sch...
• 51148 - Circles
• 51123 - Mr. Li Criteria
• 51124 - Easy Tiae words
• 51145 - Graduation Exam
• 51117 - The Most Crowded
• 51146 - Popular Baby Names
• 51131 - Running After a Thief
• 51143 - Departments Competition
• 50994 - The Most Crowded Station
• 51118 - Place 7 to the 5th position
• 51132 - Problem Solving Competition
• 51121 - Complexity power of a nu...
• 51119 - Evaluating Prefix expressions
• 50563 - Long Modulus
• 50594 - Transformations
• 51182 - Count and Sum 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.

Departments Competition

The company has taken a great purchase order and all the company started working extra to finish their part on due times. Boss started a competition among departments for extra hours worked. And there will be a special prize for the department which works the most.

Question: First, you will be given the list of people who are in the same department, then you will be given list of extra hours worked. Find the total hours of work for the department which works the most.

Input specification: You will be given two integers: number of departmental relations (m), and the number of people who worked extra (n). Following m lines will contain names of two people who are in the same department: Name contains only 26 English letters (no special chars). Each of the following n lines, contains name of a person and the number of hours and minutes worked on a specific date where 1 ≤ (n and m) ≤ 30,000. Note: Minimum extra time is calculated as 30 minutes. If a person works less than 30 minutes, it is not count for the competition.

Output specification: Show the max total hour and minute for the department which worked the most.

Sample Input 1 Sample Output 1
4 8
Joan Dilaver
Aaron Shkelzen
Irene Dilaver
Salvatore Shkelzen
Joan 9:53
Stewart 10:18
Shkelzen 9:10
Irene 3:26
Salvatore 2:07
Irene 8:54
Aaron 0:25
Shkelzen 0:29
22 13

Explanation: Here is the list of hours worked extra for each employee.

  • Aaron 0 (because it is less than 30 minutes)
  • Dilaver 0
  • Irene 12 hours 20 minutes
  • Joan 9 hours 53 minutes
  • Salvatore 2 hours 7 minutes
  • Shkelzen 9 hours 10 minutes
  • Stewart 10 hours 18 minutes
Pay attention that Stewart is not in any department. But, he is still in the competition. Joan, Dilaver and Irene are in the same department. And, they have worked totally (Max) 22 hours and 13 minutes.



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

www.contester.ru