HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Dynamic programming & Greedy > problem:


50544 - Stock market

Guest
• Discussion of problem (2)

Section problems

• 50681 - Center of a Series
• 50561 - Lucky tickets
• 50598 - Minimum Sum
• 50601 - Increasing sequence
• 50613 - Zapakovka
• 50680 - Triangle
• 50683 - Parking Buses
• 50685 - Guest Room Usage
• 50544 - Stock market
• 50545 - Diet

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