#C13171. Parking Lot Management System

    ID: 42680 Type: Default 1000ms 256MiB

Parking Lot Management System

Parking Lot Management System

You are required to build a parking lot management system with different parking spot sizes. The parking lot has three types of parking spots: small, medium, and large, with given capacities. Vehicles of different sizes must be parked according to the following rules:

  • A motorbike will park in a small spot if available, otherwise in a medium spot, and then in a large spot.
  • A car will park in a medium spot if available, otherwise in a large spot.
  • A bus will only park in a large spot.

When a vehicle leaves a parking spot, that spot becomes available again. Your program will process a sequence of commands, where each command is either to park a vehicle or to vacate a parking spot.

inputFormat

The input is read from standard input. The first line contains three integers \(S\), \(M\), and \(L\) representing the number of small, medium, and large parking spots, respectively. The second line contains an integer \(Q\) representing the number of commands. Each of the next \(Q\) lines contains a command in one of the following formats:

  • park vehicle_type: Attempt to park a vehicle of type \(vehicle_type\), where \(vehicle_type\) can be motorbike, car, or bus. For each park command, the program should output True if the vehicle is successfully parked; otherwise, output False.
  • leave spot_type: A vehicle leaves a parking spot of type \(spot_type\), where \(spot_type\) can be small, medium, or large. This command does not produce any output.

outputFormat

For each park command, print a single line with either True or False indicating whether the vehicle was successfully parked.

## sample
1 1 1
4
park motorbike
park motorbike
park motorbike
park motorbike
True

True True False

</p>