Geek and Contest ||
Easy Accuracy: 74.92% Submissions: 1017 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:

Input:
N = 5
arr[] = {450, 230, 730, 230, 150}
Output:
3 1 4 2 5
Explanation:
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:

Input:
N = 3
arr[] = {500, 500, 500}
Output:
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).

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

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.


to report an issue on this page.

Editorial

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

Yes

All Submissions

My Submissions:

Login to access your submissions.

Geek and Contest ||

Output Window