Bogo and Arrays

3.5

34 votes
Easy-Medium
Problem

Bogo is a beginner in competitive programming . Now a days she is learning about arrays . One day while she was practicing she came up with a question .

The question was :

Given a array A = {Ai , Ai+1 ,Ai+2 , . . . An} . N (Natural numbers) .

First she would write all subarrays on a piece of paper and then prepare a list of all the maximum values present in each subarray . Ultimately she want’s to know that how many numbers in the list produced are greater than a given value K . As she is only a beginner in competitive programming so she wants your help to solve this for her .

Input :

The first Line of the test case consists of T(representing number of test cases) . First line of each test case consists of two space-separated integers N and K . N representing the number of elements and K as mentioned in the problem statement .

The next line of each test case contains N space separated integers, each denoting
element of array A .

Constraints :

1<= T <= 10^5

1<= N <= 2 x 10^5

1<= Ai <= 10^9

1<= K <= 10^9

Sum of N over all the test cases does not exceed 10^6

Output : For each test case print the required output in a separate line .

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?