Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.
There are students in a queue with ID respectively. Each student has some coins . Minimum coins required for buying a meal from the canteen is .
The above process will repeat till the queue is not empty. Find the sequence of leaving the queue of students.
The first line contains an integer , the number of test cases.
Then test cases follow
The first line of each test case contains two integers and . The second line of each test case contains integers .
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, on a separate line print integers, the ID of students according to the sequence they left the queue.
Input | Output |
---|---|
1 8 7 3 1 5 3 7 4 5 2 | 5 3 7 6 1 4 8 2 |
75% Solution Ratio
ivanbrEarliest,
coderUDFastest, 0.1s
user.455533Lightest, 15 MB
Humayra_037Shortest, 411B
Login to submit
This is a simple sorting problem. One thing you can notice here that there is no difference between ...