#K75887. Highest Average API Response Time
Highest Average API Response Time
Highest Average API Response Time
You are given a list of APIs with their response times. Each API is represented by a string in the format:
API_ID: time1, time2, ... , timen
Your task is to compute the average response time for each API using the formula \(\text{average} = \frac{\text{sum of response times}}{\text{number of responses}}\) (rounded to two decimal places), and then output the API with the highest average response time. In case of a tie, the API that appears later in the input with the same average (or by the standard comparison in your algorithm) will be chosen.
The input is provided via standard input and the output should be printed to standard output.
inputFormat
The first line contains an integer N, representing the number of APIs.
Each of the following N lines contains a string in the format:
API_ID: time1, time2, ..., time_k
where API_ID
is an integer identifying the API, and time1, time2, ..., time_k
are integer response times.
outputFormat
Output two values separated by a space: the API_ID with the highest average response time and its average response time (rounded to two decimal places).
## sample3
1: 200, 300, 400
2: 150, 250, 350
3: 500, 450, 600
3 516.67