Difficulty Level:


Total Submissions: 1659 Accuracy:


Toppers Of Class

There is a class of N students and you have to find the top K marks scorers.You need to print the index of the toppers of the class which will be same as the index of the student in the input array(use 0-based indexing).First print the index of the students having highest marks then the students with second highest and so on.If there are more than one students having same marks then print their indices in ascending order.Suppose k = 2 and the students having highest marks have indices 0 and 5 and students having second highest marks have indices 6 and 7 then output will be 0 5 6 7

The first line of input consists of an integer T denoting the number of test cases .Each test case consists of three lines first line consists of an integer N denoting the number of students of class second line consists N spaced integers denoting the marks of students and third line consists of an integer K which denotes the number of top scores you have to find.

Single line output, denoting the indices of top k cores with space between them.

1<=marks of students<=10^6

It is given that k will be such that its value will always be less than or equal to type of marks of students

2 2 1 3 1
3 0 1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Jha

Set Default Code

It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use, generate link and share the link here.