#K14831. Stock Prices Analysis

    ID: 24222 Type: Default 1000ms 256MiB

Stock Prices Analysis

Stock Prices Analysis

You are given a series of stock price records, each containing a timestamp and a price. Your task is to analyze these records and determine the minimum, maximum, and average stock prices that fall within a specified time window \( [startTime,\ endTime] \).

If there are no records in the given time window, output None None None.

Note: The average price should be computed as a floating point number. Use exact arithmetic without any rounding modifications.

inputFormat

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

  • The first line contains an integer n, the number of stock price records.
  • The next n lines each contain two space-separated values: the timestamp (an integer) and the price (an integer).
  • The last line contains two space-separated integers: startTime and endTime, defining the time window.

outputFormat

The output is written to stdout and should contain three space separated values:

  • If there is at least one record within the time window, output the minimum price, the maximum price, and the average price (as a floating point number).
  • If no records fall within the time window, output None None None.
## sample
4
1 100
2 110
3 105
4 115
2 4
105 115 110.0