#K74882. Marathon Race Query Processor

    ID: 34296 Type: Default 1000ms 256MiB

Marathon Race Query Processor

Marathon Race Query Processor

Problem Statement: You are given a sequence of queries to manage a marathon race. The queries are as follows:

  • Query 1: 1 ID NAME TIME – Record the completion time of a participant with identifier ID, name NAME, and completion time TIME (in seconds). Each participant is recorded only once.
  • Query 2: 2 – Output the name of the fastest participant among all recorded participants. If multiple participants have the same completion time, return the one that was recorded earliest.
  • Query 3: 3 ID – Remove the participant with identifier ID from the records (i.e. the participant is disqualified).

If there are no participants when a type 2 query is processed, output no participants.

Process the queries in order and output the result of each type 2 query.

inputFormat

The input begins with an integer q on the first line, representing the number of queries. The following q lines each contain a query, which can be one of the following formats:

  • 1 ID NAME TIME
  • 2
  • 3 ID
Read the input from standard input (stdin).

outputFormat

For each query of type 2, output a single line with the name of the fastest participant. If no participants exist at that time, output no participants. Write the output to standard output (stdout).## sample

6
1 101 John 3600
1 102 Jane 3500
2
1 103 Bob 3000
3 102
2
Jane

Bob

</p>