Can anyone help me solve this problem?

Revision en1, by Dinocoder, 2023-10-04 20:28:28

There are N tutors who have been assigned to teach N students in a mathematics class. Every tutor's and student's knowledge about mathematics can be defined by a pair of values: A (Algebra) and G (Geometry)All the A values are pairwise distinct, and similarly, all the G values are pairwise distinct.

A tutor t can teach a student s if and only if G_{t} > G_{s} and A_{t} > A_{s}. Find the maximum number of tutor-student pairings which follow the above condition.

Input Format

The first line contains a single integer N (1 <= N <= 2 * 10 ^ 5) denoting the number of students and the number of tutors both.

The next N lines describe the students and contain two integers A (1 <= A <= 10 ^ 3) and G(1 <= G <= 10 ^ 9) per linedenoting the algebra and the geometry skill values for each student.

The next N lines describe the tutors and contain two integers A (1 <= A <= 10 ^ 9) and G(1 <= G <= 10 ^ 9) per line, denoting the algebra and the geometry skill values for each tutor

Output Format

Output maximum number of tutor-student pairings satisfying the condition

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Dinocoder 2023-10-05 17:54:46 3
en1 English Dinocoder 2023-10-04 20:28:28 1121 Initial revision (published)