题目描述
Problem Description
Among the participants of CODE FESTIVAL 2014, $ n $ people are planning to stay at a hotel.
The hotel has $ m $ rooms, and room $ i $ has a pillow with a height of $ a_i $. Due to the limited space in the hotel rooms, at most one person can stay in each room. Each participant has preferences for pillow heights, where the $ i $-th participant prefers a pillow height between $ x_i $ and $ y_i $ inclusive.
Determine the maximum number of participants who can use their preferred pillows when the hotel rooms are allocated to accommodate as many participants as possible.
Input Format
The input is given in the following format:
$ n $ $ m $ $ x_1 $ $ y_1 $ $ ... $ $ x_n $ $ y_n $ $ a_1 $ $ ... $ $ a_m $
- The first line contains the integer $ n $ ($1 \leq n \leq 100{,}000$), representing the number of people staying, and the integer $ m $ ($1 \leq m \leq 100{,}000$), representing the number of hotel rooms.
- The following $ n $ lines contain the preference ranges for the pillow heights of each participant.
- $x_i,\ y_i$ ($1 \leq x_i \leq y_i \leq 100{,}000$) indicate that the $ i $-th participant prefers a pillow height between $ x_i $ and $ y_i $ inclusive.
- The next $ m $ lines contain the heights of the pillows in each hotel room.
- $ a_i $ ($1 \leq a_i \leq 100{,}000$) indicates that the height of the pillow in the $ i $-th room is $ a_i $.
Output Format
Output a single line with the maximum number of participants who can use their preferred pillows when the hotel rooms are allocated to accommodate as many participants as possible.
Ensure there is a newline at the end, and do not include any extra characters or blank lines.
Sample Input and Output
Sample Input #1
3 3
1 2
2 3
3 4
1
2
3
Sample Output #1
3
Sample Input #2
3 3
1 2
2 3
3 4
2
4
5
Sample Output #2
2
Sample Input #3
3 4
1 4
2 3
5 5
2
4
5
6
Sample Output #3
3
Notes/Hints
None
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分