#K85582. Max Participants Allocation
Max Participants Allocation
Max Participants Allocation
In this problem, you are given two groups: one containing topics and the other containing participants. Each topic has a difficulty level and each participant has a skill level. A topic can be attended by a participant if and only if the participant's skill level is at least as high as the topic's difficulty, i.e. $$p \geq t.$$ Each participant may attend at most one topic. Your task is to determine the maximum number of topics that can be allocated a participant.
Formally, you are given two integers \(n\) and \(m\) denoting the number of topics and participants respectively, a list \(T = [t_1, t_2, ..., t_n]\) of topic difficulties, and a list \(P = [p_1, p_2, ..., p_m]\) of participant difficulties. Find the maximum number of pairs \((t_i, p_j)\) such that \(p_j \geq t_i\), ensuring that each participant is matched with at most one topic.
inputFormat
The input is given via standard input (stdin) in the following format:
- The first line contains two integers \(n\) and \(m\) representing the number of topics and participants respectively.
- The second line contains \(n\) integers representing the difficulties of the topics. If \(n = 0\), this line will be empty.
- The third line contains \(m\) integers representing the difficulties of the participants. If \(m = 0\), this line will be empty.
outputFormat
Output a single integer on standard output (stdout) representing the maximum number of topics that can be allocated a participant under the given constraints.
## sample3 5
1 3 4
1 2 3 4 5
3