#C8057. Task Assignment Permutations
Task Assignment Permutations
Task Assignment Permutations
You are given n participants and n tasks. Each participant has a certain skill level, and each task has a minimum skill requirement. Your goal is to count the number of ways to assign each participant exactly one task so that every participant's skill level is greater than or equal to the requirement of the task they are assigned.
More formally, let \(P = [p_1, p_2, \dots, p_n]\) be the list of participants' skill levels and \(T = [t_1, t_2, \dots, t_n]\) be the list of task requirements. A permutation \(\sigma\) of \(\{1, 2, \dots, n\}\) represents an assignment where participant \(i\) is assigned task \(\sigma(i)\). This assignment is valid if for every \(i\) (where \(1 \le i \le n\)), we have \[ p_i \ge t_{\sigma(i)}. \] Your task is to compute the number of valid assignments.
Note: Even if some tasks have the same requirement, assignments that differ by the indices of the tasks are considered distinct.
inputFormat
The input is given from stdin in the following format:
- An integer \(n\) (the number of participants and tasks).
- A line containing \(n\) space-separated integers representing the skill levels of the participants.
- A line containing \(n\) space-separated integers representing the task requirements.
outputFormat
Output a single integer to stdout which is the number of valid task assignments.
## sample3
4 3 2
2 2 2
6