Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. 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.
Для отправки решений необходимо выполнить вход.
|