#C8769. Airport Baggage Handling System Simulation
Airport Baggage Handling System Simulation
Airport Baggage Handling System Simulation
This problem simulates a simplified version of an airport baggage handling system. Each cart has a unique ID, a specified capacity, and a list of baggage items arriving for loading. For each cart, only the first capacity number of baggage items are loaded. Formally, if a cart has a capacity \( c \) and a list of baggage items of length \( k \), then the number of items loaded is \( \min(c, k) \).
Your task is to process the details of all carts and output, for each cart, a summary that includes the cart ID, the number of baggage items loaded, and the list of loaded baggage items.
inputFormat
The input is given via standard input (stdin) with the following format:
- The first line contains an integer \( n \) representing the number of carts.
- For each cart, there are two consecutive lines:
- The first line contains the cart ID (a string) and the cart's capacity (an integer), separated by a space.
- The second line contains the baggage items separated by spaces. If the cart has no baggage items, this line will be empty.
For example:
3 CartA 5 bag1 bag2 bag3 bag4 CartB 3 bag5 bag6 CartC 4 bag7 bag8 bag9 bag10 bag11
outputFormat
The output should be printed to standard output (stdout) and consist of multiple lines. For each cart, output three lines in the following order:
- A line in the format:
Cart ID: [cart_id]
- A line in the format:
Number of Baggage Items Loaded: [number]
- A line in the format:
Loaded Baggage Items: [item1 item2 ...]
(if no items are loaded, this line should end just after the colon)
The outputs for all carts are concatenated in the order they are provided in the input.
## sample3
CartA 5
bag1 bag2 bag3 bag4
CartB 3
bag5 bag6
CartC 4
bag7 bag8 bag9 bag10 bag11
Cart ID: CartA
Number of Baggage Items Loaded: 4
Loaded Baggage Items: bag1 bag2 bag3 bag4
Cart ID: CartB
Number of Baggage Items Loaded: 2
Loaded Baggage Items: bag5 bag6
Cart ID: CartC
Number of Baggage Items Loaded: 4
Loaded Baggage Items: bag7 bag8 bag9 bag10
</p>