Copied to Clipboard
Geek and Contest ||
Easy Accuracy: 75.1% Submissions: 1479 Points: 2

Geek hosted a contest and N students participated in it. The score of each student is given by an integer array arr[]. The task is to print the number of each student (indexes) in the order they appear on the scoreboard.
A student with a maximum score appears first. If two people have the same score then a higher indexed student appears first.

Example 1:

N = 5
arr[] = {450, 230, 730, 230, 150}
3 1 4 2 5
1. The top scorer is at 3rd index, therefore 3 
at the first index.
2. The second-highest scorer is at 1st index therefore
 1 is at the second index.
3. The third-highest scorer is at 4th index therefore
 4 at the thirst index.

Example 2:

N = 3
arr[] = {500, 500, 500}
3 2 1


Your Task:
This is a full problem. You need to write the complete code.
1. The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
2. The first line of each test case contains a single integer N.
3. The next line contains N space-separated integers.


Expected Time Complexity: O(NlogN).
Expected Auxiliary Space: O(N).

2 ≤ N ≤ 105
1 ≤ cost[i] ≤ 104

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Geek and Contest ||

Output Window