Singularity Cup P1 - Maximum Permutation Product
View as PDFYou are given a permutation  of the integers 
 to 
.
We define the value of any non-empty contiguous subarray in  as its product divided by its length.
More formally, the value of some range  is 
.
Find a subarray  that results in the maximum possible value.
Constraints
 is a permutation of 
.
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The first line of input contains an integer .
The next line of input contains  space-separated integers representing 
.
Output Specification
Output  space-separated integers 
 and 
, representing any maximum value subarray 
.
Sample Input
4
3 1 4 2
Sample Output
1 4
Comments