#K1436. Consistent Attendance Checker
Consistent Attendance Checker
Consistent Attendance Checker
You are given a list of employees along with the days they attended work. For each employee, you must determine if their attendance record is "consistent." An employee is considered consistent if for every contiguous subsequence of k attendance days, the difference between the maximum and the minimum day is at most d. Mathematically, if S is any contiguous subarray of length k from an employee’s attendance record, then the employee is consistent if:
[ \max(S) - \min(S) \le d ]
Your task is to print the employee IDs of those whose attendance records are consistent. The output should list the IDs in increasing order. If no employee meets the criteria, output an empty line.
inputFormat
The input is given from standard input in the following format:
- The first line contains three integers n, k, and d, where n is the number of employees, k is the length of the subarray to consider, and d is the maximum allowed difference.
- The next n lines each describe an employee. Each of these lines starts with an employee ID and an integer m indicating the number of attendance days, followed by m space-separated integers representing the days the employee attended.
Note: It is guaranteed that each employee has at least k attendance days.
outputFormat
Output the IDs of all employees who are consistent in attendance, in increasing order, separated by spaces. If no employee is consistent, output an empty line.
## sample4 2 3
101 6 1 5 10 15 20 25
102 6 3 6 9 12 15 18
103 6 2 3 4 5 6 7
104 6 8 16 24 1 9 17
102 103
</p>