HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Albanian National Olympiads in Informatics > problem:


2012-1. 50544 - Stock market

Guest
• Discussion of problem (2)

Volume problems

• 2010-1. 50298 - Coins
• 2010-2. 50299 - Median
• 2010-3. 50300 - Matrix
• 2012-1. 50544 - Stock market
• 2012-2. 50545 - Diet
• 2012-3. 50721 - Palindrome
• 2012-4. 50680 - Triangle
• 2012-5. 50551 - Camelot
• 2013-1. 50591 - Leap year
• 2013-3. 50570 - Prime numbers in t...
• 2013-4. 50958 - ATM
• 2013-5. 50543 - Hotel rooms

Feedback

If you notice incorrect translations in Contester, please let author know.

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


Для отправки решений необходимо выполнить вход.

www.contester.ru