#K89137. Parking Lot Simulation

    ID: 37464 Type: Default 1000ms 256MiB

Parking Lot Simulation

Parking Lot Simulation

You are given a simulation of a parking lot system. The parking lot has a limited capacity and supports two operations:

  • Add Entry: Add a vehicle's license plate along with its entry time in HH:MM format. If the parking lot is already at capacity, ignore the add operation.
  • Query Range: Given a start time and an end time (both in HH:MM), return the list of vehicles whose entry times are in the inclusive range [start, end]. The vehicles in the result should be sorted in ascending order of their entry times. If multiple vehicles have the same entry time, maintain the order in which they were added.

The time format follows the standard 24-hour clock (e.g., 08:45, 09:30). Note that lexicographical comparison of these strings is equivalent to comparing them as times.

Input and output are handled via standard input (stdin) and standard output (stdout) respectively.

inputFormat

The input begins with two integers on separate lines:

  1. The first line contains an integer C, the capacity of the parking lot.
  2. The second line contains an integer N, the number of operations.

Then follow N lines, each describing an operation in one of the following formats:

  • Add Entry: 1 license_plate entry_time (e.g. 1 AB1234 08:45).
  • Query Range: 2 start_time end_time (e.g. 2 08:00 09:00).

For each query operation, you must output on a new line the license plates (separated by a space) of the vehicles whose entry times fall within the given range. If no vehicles match the query, output an empty line.

outputFormat

For each query operation encountered in the input, output a single line containing the license plates of the vehicles (separated by a single space) that have an entry time in the inclusive range [start_time, end_time]. If no vehicles meet the criteria, output an empty line.

## sample
1000
7
1 AB1234 08:45
1 CD5678 09:30
1 EF9101 10:15
2 08:00 09:00
2 09:00 11:00
2 08:00 09:30
2 10:00 10:30
AB1234

CD5678 EF9101 AB1234 CD5678 EF9101

</p>