The seats are enumerated from 1 to 100, and the i-th seat is located exactly i meters from the conductor's place. The seats are arranged in a straight line, so there are exactly |i-j| meters between the i-th and j-th seats.
During the trip some passengers may order a tea. The orders are described by int[]s orderSeat and orderTime. The i-th order comes from the passenger at the orderSeat[i]-th seat orderTime[i] seconds after the departure. The orders will be given in chronological order, which means that the (i+1)-th order will always occur later then the i-th.
The conductor can carry at most one cup at once, so to satisfy each order he must walk to the passenger's seat, give him the tea and return back to his own place. He satisfies the orders in chronological order, i.e. in exactly the same order as they are given in the input. The conductor tries to satisfy each order as soon as possible. That is, if he has already satisfied all previous orders by the moment orderTime[i], then he will start satisfying the i-th order exactly at the moment orderTime[i]. Otherwise, he will start satisfying it immediately after all the chronologically earlier orders are satisfied. The conductor walks 1 meter per second and giving tea to a passenger takes no time, so delivering tea to the i-th passenger takes 2 * i seconds.
The passenger seated at seat inspectorSeat is an inspector. Every time the conductor passes by the inspector's seat, the inspector will write down the current time in seconds in his book. Return a int[] containing all times written down by the inspector in increasing order.
|