#C10887. Maximizing Stock Profit

    ID: 40141 Type: Default 1000ms 256MiB

Maximizing Stock Profit

Maximizing Stock Profit

You are given a list of daily stock prices, where prices[i] indicates the price on the i-th day. Your task is to determine the best day to buy and the best day to sell the stock so as to maximize the profit. The profit is defined as the difference between the selling and buying prices.

If no profitable transaction is possible, output [-1, -1].

Note: All formulas in this problem are represented in LaTeX. For instance, if you buy at price \(P_{buy}\) on day \(i\) and sell at \(P_{sell}\) on day \(j\), then the profit is described by \(P_{sell} - P_{buy}\), which should be maximized.

Read input from standard input (stdin) and write your answer to standard output (stdout).

inputFormat

The input consists of a single line containing space-separated integers. Each integer represents the stock price on a consecutive day.

outputFormat

Output two space-separated integers. These integers represent the indices of the best days to buy and sell respectively. If no profit is possible, output -1 -1.

## sample
7 1 5 3 6 4
1 4