#P4857. [PA 2013] Konduktorzy
[PA 2013] Konduktorzy
Problem Description
There is an infinitely long train with ticket inspectors. Each inspector checks carriages in one operation. Initially, all inspectors are at carriage .
Each time, the conductor orders the leftmost inspector with the smallest index to move right by steps. In total, orders are given. Output, for each inspector, which order number corresponds to the final step they make.
Input Format
The first line contains two integers .
The second line contains integers , meaning the length each inspector checks in one operation.
Output Format
Output one line with integers. The -th integer means which order number corresponds to the final step made by inspector .
10 3
3 5 6
10 9 7
Hint
For of the testdata, , , , .
Translated by ChatGPT 5