Contents
Javelin Qualification solution codechef

For Solution
Click Here!
There are NN players with IDs from 11 to NN, who are participating in the Javelin throw competition which has two rounds. The first is the qualification round, followed by the final round. The qualification round has gotten over, and you are given the longest distance that each of the NN players has thrown as A1,A2,…,ANA1,A2,…,AN. Now, the selection process for the final round happens in the following two steps:
1) If the longest throw of a player in the qualification round is greater than or equal to the qualification mark of MM cm, they qualify for the final round.
2) If after step 11, less than XX players have qualified for the finals, the remaining spots are filled by players who have thrown the maximum distance among the players who have not qualified yet. Javelin Qualification solution codechef
You are given the best throws of the NN players in the qualification round A1,A2,…,ANA1,A2,…,AN and the integers MM and XX. Print the list of the players who will qualify for the finals in increasing order of their IDs.
Input Format
 The first line of input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
 The first line of each test case contains three spaceseparated integers N,M,XN,M,X.
 The second line of each test case contains NN spaceseparated integers A1,A2,…,ANA1,A2,…,AN.
Output Format Javelin Qualification solution codechef
 For each test case, print a single line containing K+1K+1 spaceseparated integers, where KK is the number of players qualified.
 First, print the integer KK, then followed by a space, print KK spaceseparated integers ID1,ID2,…,IDKID1,ID2,…,IDK where IDiIDi denotes the players’ ID who qualified for the finals.
 You have to print the IDs of the qualified players in increasing order.
Constraints
 1≤T≤10001≤T≤1000
 2≤X≤N≤302≤X≤N≤30
 5000≤Ai≤80005000≤Ai≤8000
 7000≤M≤80007000≤M≤8000
 All AiAis are distinct
Sample Input 1 Javelin Qualification solution codechef
3
3 8000 2
5000 5001 5002
3 5000 2
7999 7998 8000
4 6000 3
5999 5998 6000 6001
Sample Output 1
2 2 3
3 1 2 3
3 1 3 4
Explanation
Test Case 11: Since no player crosses the qualification mark, they are chosen based on the distance thrown. So player 33 who has thrown the maximum distance gets selected followed by the player 22. Now since we have got the required number of players, player 11 isn’t selected.
Test Case 22: Since all the players cross the qualification mark, they all are selected.
Test Case 33: The player 33 and player 44 cross the qualification mark. So for the third and final spot in the final, the player 11 is selected since he ha

For Solution
Click Here!