HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Questions 2016 > problem:


15-RE-2. 50999 - Overlapping Trips

CEN112 Questions 2016

Start: Mar.30.2016 at 03:10:22 PM
Finish: Apr.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 15-PE2-1. 50980 - The smallest rect...
• 15-PE2-2. 50981 - Top popular m-st...
• 15-PE2-2. 50984 - Top m hardworki...
• 15-PE2-2. 51086 - Top popular student
• 15-PE2-3. 50982 - A thief in labyrinth
• 15-PE2-4. 50983 - Course Selection
• 15-PE2-6. 50985 - Books Waiting
• 15-PE2-8. 50987 - Very Looong Queue
• 15-RE-2. 50999 - Overlapping Tr...
• 3. 51002 - The most successful classes
• 4. 51003 - Double Prime
• HW092. 51081 - Fish Pond I
• HW092. 51062 - Fish Pond II

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.

Overlapping Trips

The school administration has just realized that there are two activities overlapping. So, the administration wants to see the list of participants and collusions. When collecting the lists, organizers have collected student ID, class information and the amount of money given for the activity.

Question: Write a program that reads the participants list of two programs then print the number of people participating to the activities. If a person is in two activities, he chooses the cheaper one. If the prices are also the same, the person chooses the first activity if his/her id is odd, the second activity otherwise.

Input specification: In the first line, you will be given two integers: the number of people participating to the first (n) and the second (m) activities. Then, the following n lines contain the people information for the first activity. And the next m lines, contain the people information for the second activity where each line contains:

  • Student ID: at most 8 digit integer
  • Class information is at most 8 char string containing alpha-numeric chars
  • amount: a floating point number not greater than 1e7
and 1 ≤ m ≤ n ≤ 30,000.

Output specification: Show two integers.

Sample Input
4 5
3 CEN1 20
4 CEN1 28
7 CEN2 10
12 ECE1 21
2 ECE1 19
4 CEN2 10
7 CEN2 15
11 ECE2 21
12 ECE1 20
Sample Output
2 4

Explanation: People with the IDs 4, 7 and 12 are in two activity lists. ID 7 chooses the first activity, 4 and 12 chooses the second activity. Thus, there are 2 people in the first activity and there are 4 people in the second activity.



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

www.contester.ru