← 返回 amazon 的题目列表Design a Parking Lot System
类型:online_judge
Design a parking lot system. The parking lot must support the following operations:
Vehicle entry and exit: Compact cars, medium cars, and large cars occupy different sizes of parking spaces.
Query the number of available spaces.
Cars leaving the lot. The system must allocate the appropriate parking space based on vehicle type and size.
Input Description
Total number of operations n (1 ≤ n ≤ 1000). The next n lines represent operations:
Entry operation: enter small, enter medium, enter large
Exit operation: exit small, exit medium, exit large
Initially, the number of spaces available for each type: small_capacity, medium_capacity, large_capacity.
Output Description
For each entry or exit operation, output whether the parking was successful or the number of available spaces.
Example
Input:
6
5 3 2
enter small
enter medium
enter large
exit small
enter large
exit large
Output:
Success
Success
Success
Success
Success
Success
Example
Input
6
5 3 2
enter small
enter medium
enter large
exit small
enter large
exit large