#K5556. Employee Qualification Check
Employee Qualification Check
Employee Qualification Check
You are given a set of positions and a set of employees. Each position requires a list of subjects with a minimum expertise level. Similarly, each employee has knowledge in several subjects with their corresponding expertise levels.
An employee qualifies for a position if for every required subject in that position, the employee's expertise level is at least the required level. Your task is to determine for each employee whether they qualify for at least one of the positions.
Note: An employee qualifies for a position only when all subject requirements for that position are met. The problem involves basic iteration and comparison of skill levels.
inputFormat
The first line contains two integers N and M separated by a space, where N is the number of positions and M is the number of employees.
This is followed by N lines describing each position. Each of these lines starts with an integer K (the number of subject requirements for the position), followed by K pairs. Each pair consists of a subject name (a string without spaces) and an integer representing the required expertise level.
After the positions, there are M lines describing each employee. Each such line starts with an integer L (the number of subjects the employee is knowledgeable about), followed by L pairs. Each pair consists of a subject name and an integer representing the employee's expertise level.
All input is given via standard input.
outputFormat
For each employee, output a line containing either YES
if the employee qualifies for at least one position, or NO
otherwise. The outputs should be written to standard output, one per line.
2 3
2 math 5 physics 7
3 math 4 physics 6 chemistry 5
2 math 5 physics 7
3 math 5 physics 7 chemistry 4
1 physics 8
YES
YES
NO
</p>