시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
20 초 (추가 시간 없음) | 1024 MB | 53 | 25 | 23 | 48.936% |
There are N people numbered from 1 to N, standing in a queue to withdraw money from an ATM. The queue is formed in ascending order of their number. The person numbered i wants to withdraw amount Ai. The maximum amount a person can withdraw at a time is X. If they need more money than X, they need to go stand at the end of the queue and wait for their turn in line. A person leaves the queue once they have withdrawn the required amount.
You need to find the order in which all the people leave the queue.
The first line of the input gives the number of test cases T. T test cases follow.
The first line of each test case gives two space separated integers: the number of people standing in the queue, N and the maximum amount X that can be withdrawn in one turn.
The next line contains N space separated integers Ai.
For each test case, output one line containing Case #x: y
, where x
is the test case number (starting from 1) and y
is the space separated list of integers that denote the order in which the people leave the queue.
2 3 3 2 7 4 5 6 9 10 4 7 2
Case #1: 1 3 2 Case #2: 3 5 1 2 4
In Sample Case #1, there are 3 people and the limit to withdraw in one turn is 3. Below is step-by-step description of how the process will look like:
The order in which people leave the queue is [1, 3, 2].
In Sample Case #2, there are 5 people and the limit to withdraw in one turn is 6. Below is step-by-step description of how the process will look like:
The order in which people leave the queue is [3, 5, 1, 2, 4].
Contest > Google > Kick Start > Google Kick Start 2020 > Round F A번