#C182. Job Candidate Matching
Job Candidate Matching
Job Candidate Matching
You are given a system for matching job candidates with available jobs based on required skills. Each candidate is identified by an integer candidate_id and a set of skills, and each job is identified by an integer job_id along with a set of required skills. A candidate is considered a match for a job if and only if the job's required skills are a subset of the candidate's skills.
Your task is to implement the matching functionality. The program will receive input from standard input (stdin) and output the answer to standard output (stdout). The input will consist of candidate and job information followed by queries. For each query, output the matching job_ids in ascending order separated by spaces. If no job matches, print an empty line.
The input format is as follows:
- The first line contains two integers: N (number of candidates) and M (number of jobs).
- The next N lines each describe a candidate. Each candidate description starts with an integer candidate_id, followed by an integer K (the number of skills), and then K strings representing the skills.
- The next M lines each describe a job. Each job description starts with an integer job_id, followed by an integer L (the number of required skills), and then L strings representing the required skills.
- The next line contains a single integer Q indicating the number of queries.
- The following Q lines each contain a candidate_id for which the matching jobs need to be found.
For each query, output a single line containing the matching job_ids in ascending order separated by spaces (if any), or an empty line if no matching job exists.
Note: All formulas and conditions mentioned are in LaTeX where applicable. For example, if is the set of skills of a candidate and is the set of skills required by a job, then a job matches if .
inputFormat
The first line contains two integers and . The next lines each contain a candidate's information: candidate_id, the number of skills, and the list of skills. The following lines each contain a job's information: job_id, the number of required skills, and the list of required skills. After that, there is an integer representing the number of queries. The next lines each contain one candidate_id, representing a query.
outputFormat
For each query, print a single line containing the matching job_ids in ascending order separated by a single space. If no job matches, print an empty line.## sample
2 2
1 3 python java sql
2 3 javascript css html
101 2 python sql
102 3 javascript css html
2
1
2
101
102
</p>