HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Search > problem:


50999 - Overlapping Trips

Guest
• Review clarifications (1)

Section problems

• 50786 - Top Question
• 50788 - Eight Puzzle
• 50504 - School contest
• 50787 - Expected Value
• 50859 - Low performance
• 50785 - Swimming Contest
• 50826 - Olive Containers
• 50866 - Buy the cheapest
• 50999 - Overlapping Trips
• 50507 - Sequential Numbers
• 50501 - The Highest Average
• 50434 - Row Min Subtraction
• 50980 - The smallest rectangle
• 50860 - Number of Student Certificates
• 50832 - Rock Paper Scissors Lizard ...
• 50834 - The train which leaves the f...
• 51078 - Max trade

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