#K35597. Count Employees with Required Skills
Count Employees with Required Skills
Count Employees with Required Skills
You are given a company database with n employees. Each employee record consists of an employee ID and a list of skill identifiers. Your task is to answer q queries. In each query, a non-negative integer is provided, and you must determine how many employees have at least that many skills.
Formally, let \(c_i\) denote the number of skills of the \(i\)th employee. For each query value \(Q\), you need to compute the number of employees such that \(c_i \ge Q\).
The input is given from standard input and the output should be printed to standard output.
inputFormat
The first line of input contains two integers n
and q
separated by a space, where:
n
is the number of employees.q
is the number of queries.
This is followed by n
lines, each describing an employee. Each employee description begins with an integer representing the employee ID, followed by an integer k
denoting the number of skills the employee has, and then k
integers representing the individual skills.
The last line contains q
integers separated by spaces. Each integer represents a query specifying a minimum number of skills.
outputFormat
Output a single line containing q
integers separated by spaces. Each integer corresponds to the number of employees who have at least the given number of skills for that query.
5 3
101 3 3 44 33
102 2 33 77
103 4 55 44 33 77
104 1 33
105 5 22 33 44 55 66
1 4 3
5 2 3
</p>