시간 제한
메모리 제한
시간 제한
1초
메모리 제한
128 MB
In this problem we deal with the calculation of stock prices. You need to know the following things about stock prices:
Whenever the bid price is greater than or equal to the ask price, a deal is established. A buy order offering the bid price is matched with a sell order demanding the ask price, and shares are exchanged at the rate of the ask price until either the sell order or the buy order (or both) is fulfilled (i.e., the buyer wants no more stocks, or the seller wants to sell no more stocks). You will be given a list of orders (either buy or sell) and you have to calculate, after each order, the current ask price, bid price and stock price.
On the first line a positive integer: the number of test cases, at most 100. After that per test case:
Per test case: