|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||19||5||4||23.529%|
A local company, “DVDs R Us”, need your help with a stock management system. They sell DVDs on-line from a local warehouse and need to know at any moment how many DVDs of each title they have in stock.
DVDs of a particular title have a stock code and are allocated a certain amount of storeage space in the warehouse. The more popular a DVD title is, the more space is allocated. DVDs are continually being sold and replaced, hence the need for a system to keep track of how many are in stock.
Input consists of data about a number of DVD titles. The data for a DVD title begins with a stock code, a 7 character code consisting of upper case letters and digits only. Input is terminated by a code consisting of a single # - do not process this title.
The next line for each title consists of two integers, M and S, separated by a space. M is the maximum number of DVDs of that title that can be held in stock at any one time (20 <= M <= 500). S is the number of that title currently in stock (0 <= S <= M).
The third line is a single integer, T, the number of transactions to follow (0 < T <= 100). There then follow T lines, each containing details of 1 transaction. A transaction line consists of a single upper case letter (S or R), followed by a space, followed by a positive integer less than 1000.
Output consists of the DVD's stock code, followed by a space, followed by the number in stock at the end of all the transactions.
HG67966 100 64 3 S 10 S 25 R 30 #