#K15346. Maximum Assignable Tasks

    ID: 24336 Type: Default 1000ms 256MiB

Maximum Assignable Tasks

Maximum Assignable Tasks

You are given several test cases. In each test case, you are provided with a list of employees and a list of tasks. Each employee has a competence level, and each task has a difficulty level. An employee can only be assigned at most one task, and an employee can perform a task only if their competence is greater than or equal to the task's difficulty.

Your goal is to calculate the maximum number of tasks that can be assigned under these conditions.

Formally, suppose an employee's competence is denoted by \(c\) and a task's difficulty by \(d\). The assignment is valid only if \(c \ge d\). You need to maximize the number of valid assignments so that no employee is assigned more than one task and no task is assigned to more than one employee.

inputFormat

The first line of the input contains an integer \(T\), which denotes the number of test cases.

Each test case follows the format below:

  • The first line contains two space-separated integers \(E\) and \(K\) representing the number of employees and the number of tasks respectively.
  • The second line contains \(E\) space-separated integers, representing the competence levels of the employees.
  • The third line contains \(K\) space-separated integers, representing the difficulty levels of the tasks.

outputFormat

For each test case, output a single line containing one integer, which is the maximum number of tasks that can be assigned.

## sample
3
3 4
4 5 3
3 5 2 1
2 2
2 9
9999 1
2 4
10 20
1 2 3 4
3

1 2

</p>