#C5351. Email Response Time Analysis

    ID: 48991 Type: Default 1000ms 256MiB

Email Response Time Analysis

Email Response Time Analysis

You are given a log of emails. Each email entry consists of an email identifier, a sending timestamp and a response timestamp. The timestamps are provided in the format YYYY-MM-DD HH:MM:SS. Your task is to compute the response time (in seconds) for each email using the formula \( \Delta t = t_{response} - t_{send} \). After calculating the response times, output the list of email identifiers with their response times and then print the email with the fastest response.

inputFormat

The input is provided via standard input (stdin). The first line contains an integer \( n \) (\( n \ge 1 \)) denoting the number of emails. Each of the following \( n \) lines contains 5 space-separated tokens:

  1. email_id
  2. send_date in the format YYYY-MM-DD
  3. send_time in the format HH:MM:SS
  4. response_date in the format YYYY-MM-DD
  5. response_time in the format HH:MM:SS

You should reconstruct the timestamps as send_date + ' ' + send_time and response_date + ' ' + response_time respectively.

outputFormat

Output via standard output (stdout): First, output \( n \) lines, each containing the email_id and its response time (in seconds), separated by a space. Then output an extra line containing the email_id with the fastest response and its response time.

## sample
3
email1 2022-09-15 10:34:50 2022-09-15 10:36:50
email2 2022-09-15 11:00:00 2022-09-15 11:10:30
email3 2022-09-15 12:15:45 2022-09-15 12:15:55
email1 120

email2 630 email3 10 email3 10

</p>