Given n students in a fixed queue and their per-item service times, report the item each student is on or waiting for at time t+0.5.
Hard8SimulationMathPrefix sumImplementationNo attempts yetTime limit2sMemory limit512 MBEvery student at the university has to take a medical checkup. The checkup items are numbered 1, 2, 3, and so on, and there is no limit on the number of items.
The students stand in one long queue, waiting for the checkup to start. They are numbered 1, 2, 3, and so on from the front of the queue. A student has to take the items in increasing order of the item number, skipping none of them and reordering none of them. The order of the students does not change either.
Different items run in parallel, but one item handles only one student at a time. A student therefore waits in the queue of the next item until everyone ahead has finished that item.
Each student has an integer value called the health condition. A student whose health condition is h needs h minutes to finish each item. Assume that no time passes between two students on the same item, and none between two items of the same student.
Find, at a given moment, the item that each student is being checked on or is waiting for.
The input is a single test case in the following format.
n t
h1
.
.
.
hn
n and t are integers. n is the number of students (1≤n≤105), and t is the moment of interest (0≤t≤109). For each i, the integer hi is the health condition of student i (1≤hi≤109).
Print n lines, each holding a single integer. Line i holds the number of the item that student i is being checked on or is waiting for, at (t+0.5) minutes after the checkup starts. You may assume that every student still has items left to finish at that moment.