#K83397. Bin Operations
Bin Operations
Bin Operations
You are given N bins and each bin has a unique id and a maximum capacity. Initially, every bin is empty. You need to process M operations on these bins. There are three types of operations:
- Add Operation (Type 1): Add a given number of items to the bin.
- Remove Operation (Type 2): Remove a given number of items from the bin.
- Query Operation (Type 3): Check if the bin is full. A bin is considered full if its current number of items is greater than or equal to its capacity; in mathematical terms, if \(items \ge capacity\) then the bin is full.
Your task is to simulate these operations and for every query operation output the status of the queried bin by printing full
if the bin is full; otherwise, print not full
.
inputFormat
The input is given via standard input (stdin) and has the following format:
- An integer
N
representing the number of bins. N
lines follow, each containing two integers:bin_id
andcapacity
.- An integer
M
representing the number of operations. M
lines follow. Each line represents one operation and is formatted as follows:- For add operations (Type 1) and remove operations (Type 2):
t bin_id x
, wheret
is the operation type andx
is the number of items to add or remove. - For query operations (Type 3):
t bin_id
.
- For add operations (Type 1) and remove operations (Type 2):
outputFormat
For each query operation (Type 3), print the status of the bin on a new line. Print full
if the bin is full (i.e. its current number of items is greater than or equal to its capacity), otherwise print not full
.
4
1 10
2 15
3 20
4 25
6
1 1 5
1 2 10
3 1
2 1 3
3 2
3 3
not full
not full
not full
</p>