#K84217. Determining the Highest Prize Tier

    ID: 36371 Type: Default 1000ms 256MiB

Determining the Highest Prize Tier

Determining the Highest Prize Tier

You are given a participant's score and a series of increasing thresholds, each corresponding to a prize tier. A participant qualifies for a prize tier if their score is greater than or equal to its threshold.

The highest prize tier is defined as the maximum tier index (starting from 1) for which the condition holds. Formally, let \( t_1, t_2, \dots, t_n \) be the thresholds. The answer is the largest integer \( k \) (or 0 if no such \( k \) exists) such that \( score \ge t_k \).

You will be given multiple test cases to process.

inputFormat

The input is given via STDIN and has the following format:

T
score_1
threshold_1[threshold_2 ... threshold_m]
score_2
threshold_1[threshold_2 ... threshold_p]
...
score_T
threshold_1[threshold_2 ... threshold_q]

Here, the first line contains an integer T representing the number of test cases. For each test case, the first line contains the participant's score, and the second line contains a space‐separated list of thresholds in increasing order.

outputFormat

For each test case, output a single line containing the highest prize tier (an integer). If the participant does not qualify for any prize tier, output 0.

The output should be written to STDOUT.

## sample
3
120
50 100 150
75
50 100
160
40 80 120 200
2

1 3

</p>