#C11388. Maximum Framed Paintings
Maximum Framed Paintings
Maximum Framed Paintings
You are given a set of paintings and a set of frames. Each painting and frame is represented by its width and height. A painting can be placed in a frame if and only if its width and height are both less than or equal to the corresponding dimensions of the frame. In other words, for a painting with dimensions \(w_p\) and \(h_p\) to fit in a frame of dimensions \(w_f\) and \(h_f\), the conditions \(w_p \leq w_f\) and \(h_p \leq h_f\) must hold.
Your task is to determine the maximum number of paintings that can be framed. Each frame can be used at most once.
inputFormat
The first line contains two integers \(m\) and \(n\) where \(m\) denotes the number of paintings and \(n\) denotes the number of frames.
The next \(m\) lines each contain two integers representing the width and height of a painting.
The following \(n\) lines each contain two integers representing the width and height of a frame.
outputFormat
Output a single integer—the maximum number of paintings that can be framed.
## sample3 2
12 11
15 10
10 10
20 20
15 10
2