#K9256. Conveyor Belt Shipment Simulation
Conveyor Belt Shipment Simulation
Conveyor Belt Shipment Simulation
You are given a conveyor belt system that handles shipments. Each shipment is added with a unique shipment_id and a number of packages. The belt processes packages in the order that shipments are added. When processing, packages are taken from the front shipment until either the current process batch is finished or the shipment is completed. A shipment is Complete if all its packages have been processed; otherwise, it is Incomplete.
In formal terms, if a shipment with ID \( s \) has \( P_s \) packages added and \( Q_s \) packages processed, then the shipment is complete if \( Q_s = P_s \) and incomplete otherwise.
inputFormat
The input is read from standard input (stdin). The first line contains an integer ( T ), the number of commands. Each of the following ( T ) lines contains a command in one of three formats:
- Add shipment_id num_packages
- Process num_packages
- Query shipment_id
For the 'Add' command, add a shipment with the specified id and number of packages. For the 'Process' command, process the given number of packages from the shipments in first-in-first-out order, and for 'Query', output the status of the shipment.
outputFormat
For every 'Query' command, output one line to standard output (stdout) containing the status of the shipment: either 'Complete' if all packages in that shipment have been processed or 'Incomplete' otherwise.## sample
6
Add 1 5
Add 2 3
Process 4
Query 1
Process 4
Query 1
Incomplete
Complete
</p>