#K13296. Find Airing Show Index

    ID: 23881 Type: Default 1000ms 256MiB

Find Airing Show Index

Find Airing Show Index

You are given a list of query times and a schedule of shows on a single TV channel. Each show has a start time and an end time in (HH:MM) 24-hour format. For each query time, determine the 1-based index of the show that is airing at that moment. A query time is considered to fall within a show if it is between the show’s start and end times (inclusive). In cases where a query time falls into multiple shows, select the show that appears first in the schedule. If no show is airing at that time, output "None".

For example, if the schedule contains a show from 08:00 to 10:00 and the query time is 10:00, the answer is 1 since it lies within the show's time range.

inputFormat

The input is read from standard input and has the following format:

1. An integer (Q) representing the number of query times.
2. (Q) lines each containing a query time in (HH:MM) format.
3. An integer (N) representing the number of shows in the schedule.
4. (N) lines each containing two time values (the start and end time) separated by a space, both in (HH:MM) format.

outputFormat

For each query time, output the corresponding 1-based index of the airing show on a new line. If no show is airing at that query time, output "None".## sample

1
08:00
1
08:00 10:00
1

</p>