#K2771. Maximum Completed Tasks
Maximum Completed Tasks
Maximum Completed Tasks
You are given T tasks and W workers. Each task requires a minimum skill level, and each worker has a certain skill level. A worker can complete a task only if the worker's skill level is at least as high as the task's requirement. Each worker can complete at most one task. Your goal is to determine the maximum number of tasks that can be completed.
More formally, for a task requirement \(a\) and a worker with skill \(b\), the task can be completed if \(b \ge a\). Tasks and workers can be processed in any order.
Input/Output Format: The input is taken from the standard input, and the result must be printed to the standard output.
inputFormat
The first line contains two integers T
and W
, representing the number of tasks and the number of workers, respectively.
The second line contains T
integers representing the required skill levels for each task. If T
is 0, this line will be empty.
The third line contains W
integers representing the skill levels of the workers. If W
is 0, this line will be empty.
outputFormat
Print a single integer denoting the maximum number of tasks that can be completed.
## sample3 3
3 2 1
5 3 2
3