HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN254 Final Exam > problem:


2. 51143 - Departments Competition

CEN254 Final Exam

Start: June.23.2017 at 12:25:00 PM
Finish: June.23.2017 at 01:25:00 PM
The contest is finished!
• Contest scoreboard

Contest problems

• 1. 51142 - Jump Min Value
• 2. 51143 - Departments Competi...
• 3. 51082 - Sum is equal to K - 1
• 4. 51145 - Graduation Exam

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