Question: Prob E Notes : IN C LANGUAGE USE BASIC CODE DONT USE VOID MAIN INPUT AND OUTPUT MUST BE SAME Maximum You are given an

Prob E

Prob E Notes : IN C LANGUAGE USE BASIC CODE DONT USE

Notes : IN C LANGUAGE

USE BASIC CODE

DONT USE VOID MAIN

INPUT AND OUTPUT MUST BE SAME

Maximum You are given an array of N integers, A1, A2, An, and M integers, X1, X2, ..., XM. For each X; where is an integer from 1 to M, you are asked to find the minimum index Y, such that the maximum value of (A1, A2, ..., Ay) >= Xi. Format Input The first line consist of two integers, N and M. The second line consist of N integers, A1, A2, An. The third line consist of M integers, X1, X2, 6XM. Format Output Output M lines, each consist of an integer which is the minimum index Y, such that the maximum value of (A1, A2, ..., Ay) >= Xi. If no such Y is found, output"-1". Constraints 1SN,M S105 1 AiXi 109 Sample Input 1 (standard input) 74 1 1 2 3 3 3 1 3 2 8 3 Sample Output 1 (standard output) F 1 4 -1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!