#C3605. Maximizing Completed Projects

    ID: 47051 Type: Default 1000ms 256MiB

Maximizing Completed Projects

Maximizing Completed Projects

You are given two lists: one representing workers' skill levels and the other representing the minimum skill level required for projects. Your task is to determine the maximum number of projects that can be completed using the available workers.

A worker can complete a project if and only if the worker's skill level is at least as high as the project's required skill level. Formally, if we denote a worker's skill by \( w \) and a project's required skill by \( p \), then the worker can do the project if \( w \geq p \).

Note that each worker can only be assigned to one project, and projects are assigned greedily after sorting both lists in non-decreasing order.

inputFormat

The input is read from standard input (stdin) and consists of the following:

  1. An integer \( n \) representing the number of workers.
  2. A line of \( n \) space-separated integers representing the skill levels of the workers.
  3. An integer \( m \) representing the number of projects.
  4. A line of \( m \) space-separated integers representing the minimum required skill levels for the projects.

outputFormat

Output a single integer to standard output (stdout) representing the maximum number of projects that can be completed.

## sample
5
3 1 4 1 5
4
2 1 3 4
4

</p>