Quality Tea
Output: Standard Output (stdout)
Memory limit: 50 megabytes
Time limit: 1.0 seconds
TLC have decided to start producing their own tea.
You have been asked to write a quality control program that monitors batches of products for faults.
A batch of N products (3 \le N \le 1000) is considered to be faulty if it contains three consecutive defective products anywhere along the production line. A product is defective if its quality level q_i is less than the quality threshold K (1 \le q_i, K \le 100).
Your task is to determine whether the current batch of products is faulty or not.
Input
The first line will contain two space separated integers, N, the number of products in the current batch, and K, the quality threshold.
The next N lines contain the quality levels of the current batch of products in order along the production line. Each quality level q_i will be an integer on its own line.
Output
If the current batch of products is faulty, you should print Fault Detected
on a single line. On the next line, print the first three consecutive quality levels which failed, separated by spaces.
Otherwise, print No Fault
instead.
Subtasks
- Subtask 1 (40%) There will always be exactly three quality values to check (N=3 is guaranteed).
- Subtask 2 (60%) The full solution.
-
Sample Input 1
3 100 1 2 3
Sample Output 1
Fault Detected 1 2 3
-
Sample Input 2
5 50 90 87 44 49 91
Sample Output 2
No Fault
-
Sample Input 3
10 8 3 9 8 7 10 2 7 1 6 9
Sample Output 3
Fault Detected 2 7 1