Time limit 4000/7000/7000/7000 ms. Memory limit 65000/65000/65000/65000 Kb. Olympiad 2012. Prepared by: Evis Hoxha.
Difficulty Beta
Question 1- Stock market
There are given n values that represent the values of the indexes of a company X. Positive values represent increase of the shares, while negative values represent decrease of the shares. Write a program that, after reading the n values of the indexes, shows the segment of the days when the profit is maximal. The program returns the starting and ending position of the segment.The profit is calculated by adding the earned or lost points in the days included in the segment.
Input
The first line contains a number n. 2 <= n <= 100000 Then the following line contains n values, representing the shares.
Output
Show the initial and ending position of the interval where the profit is maximal.
Input I
|
9
2 -5 2 6 7 -10 11 -6 8 |
Output 1 |
3 9 |
Для отправки решений необходимо выполнить вход.
|