#K13401. Parking Slot Management
Parking Slot Management
Parking Slot Management
Problem Description:
You are given ( n ) parking slots, each with a provided capacity (for future reference), and you need to simulate a series of queries on these slots. There are three types of queries:
1. + x y
: Park ( y ) vehicles in slot ( x ).
2. - x y
: Remove ( y ) vehicles from slot ( x ).
3. ?
: Query the current number of vehicles parked in each slot.
For every query of type ( ? ), output the current state as a space-separated list of parked vehicles.
Note: Although capacities for each slot are provided, they do not restrict the number of vehicles parked.
inputFormat
Input is provided via standard input (stdin) and has the following format:
( n )
Next ( n ) lines: Each line contains an integer representing the capacity of a parking slot (this value is not used in the simulation).
( q )
Next ( q ) lines: Each line is a query in one of the following formats: + x y
, - x y
, or ?
.
Queries must be processed in the order given.
outputFormat
For each query of type ( ? ), output a single line that shows the current number of parked vehicles in each slot, separated by a space. Output is sent to standard output (stdout).## sample
3
10
15
5
12
+ 1 5
+ 2 10
+ 3 3
?
- 2 4
?
+ 3 1
?
+ 1 6
?
- 3 2
?
5 10 3
5 6 3
5 6 4
11 6 4
11 6 2
</p>